Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Lucene.Net 4.8.0
-
None
-
Patch
Description
https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Core/Support/ListExtensions.cs#L18
"lt.Add(item);" should be changed to "list.Add(item)"
----------------------------------------------------------------------
https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Core/Support/ListExtensions.cs#L82
"if (current == null && item == null)"
The condition means that the list can have null elements.
However, at https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Core/Support/ListExtensions.cs#L85
"if (current.Equals(item))"
current.Equals() is invoked, thus if the list have a null element, null reference exception would be thrown here.
I suggest to change the condition to (current != null && current.Equals(item)).