The method nullSafeEqualityComparison uses the compareTo method which is not null safe. The issue can be reproduce by calling nullSafeEqualityComparison with the second parameter null.
There are two possible fixes:
1) use equals instead of compareTo in nullSafeEqualityComparison
2) or add a check for the non nullity of the second argument.