Lucene.Net.Core.Util.PriorityQueue: Fixed issue with comparison of sentinel object - it should compare against default(T) instead of null to determine if it is supported.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b69f8e8a Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b69f8e8a Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b69f8e8a Branch: refs/heads/api-work Commit: b69f8e8a6866a590710839e15f10d51a4a532e27 Parents: ae79c53 Author: Shad Storhaug <[email protected]> Authored: Wed Mar 8 17:50:00 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Wed Mar 8 17:50:00 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/PriorityQueue.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b69f8e8a/src/Lucene.Net.Core/Util/PriorityQueue.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/PriorityQueue.cs b/src/Lucene.Net.Core/Util/PriorityQueue.cs index 0f1a070..e23502e 100644 --- a/src/Lucene.Net.Core/Util/PriorityQueue.cs +++ b/src/Lucene.Net.Core/Util/PriorityQueue.cs @@ -1,5 +1,6 @@ -using System; using Lucene.Net.Support; +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace Lucene.Net.Util @@ -84,7 +85,7 @@ namespace Lucene.Net.Util { // If sentinel objects are supported, populate the queue with them T sentinel = GetSentinelObject(); - if (sentinel != null) + if (!EqualityComparer<T>.Default.Equals(sentinel, default(T))) { heap[1] = sentinel; for (int i = 2; i < heap.Length; i++)
