lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shad Storhaug (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LUCENENET-558) Some possible null reference exceptions in ListExtensions.cs
Date Fri, 05 May 2017 20:48:04 GMT

     [ https://issues.apache.org/jira/browse/LUCENENET-558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shad Storhaug resolved LUCENENET-558.
-------------------------------------
    Resolution: Fixed
      Assignee: Shad Storhaug

Fixed via https://github.com/apache/lucenenet/commit/56bc9e0135c7bf1a9c9aa00f37e6ad79666dcdfd

Note that some of this code was removed.

> Some possible null reference exceptions in  ListExtensions.cs
> -------------------------------------------------------------
>
>                 Key: LUCENENET-558
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-558
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Core
>    Affects Versions: Lucene.Net 4.8.0
>            Reporter: Vladimir Koshelev
>            Assignee: Shad Storhaug
>             Fix For: Lucene.Net 4.8.0
>
>
> 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)).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message