Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
NullPointerExcption when comparing not initialized list with initialized list #240
I use the LevenshteinListChangeAppender to compare objects containing lists. The Obejcts are unmarshalled from XML. Unmarshalling leaves empty Lists as "null" in the variable, they are only initialized, when the get method is first called.
If I compare an empty list (=null) with a list containing values, I get a NullPointerException in org.javers.core.diff.appenders.levenshtein.Backtrack line 21/22 because the Lists are accessed without check for null.
It would be good to check for null first and initialize the check with an empty list if null is returned. Alternatively the get method could be used instead of directly accessing the list variable in the class.