lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [06/12] lucenenet git commit: Fixed bug in QueryParser.Surround.Query.DistanceQuery.DistanceSubQueryNotAllowed() that was causing a null reference exception when the type of query does not implement IDistanceSubQuery.
Date Sun, 02 Oct 2016 10:22:17 GMT
Fixed bug in QueryParser.Surround.Query.DistanceQuery.DistanceSubQueryNotAllowed() that was
causing a null reference exception when the type of query does not implement IDistanceSubQuery.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f4f94534
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f4f94534
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f4f94534

Branch: refs/heads/master
Commit: f4f94534d902fa8a5ec67b9acc34a6446838f5ce
Parents: 834d91e
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Sep 22 12:38:28 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Sep 22 12:38:28 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f4f94534/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
index 0cf6fe1..7e4217d 100644
--- a/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
+++ b/src/Lucene.Net.QueryParser/Surround/Query/DistanceQuery.cs
@@ -51,9 +51,10 @@ namespace Lucene.Net.QueryParsers.Surround.Query
             var sqi = GetSubQueriesEnumerator();
             while (sqi.MoveNext())
             {
-                var dsq = sqi.Current as IDistanceSubQuery;
-                if (dsq != null)
+                var leq = sqi.Current;
+                if (leq is IDistanceSubQuery)
                 {
+                    var dsq = sqi.Current as IDistanceSubQuery;
                     string m = dsq.DistanceSubQueryNotAllowed();
                     if (m != null)
                     {
@@ -62,7 +63,7 @@ namespace Lucene.Net.QueryParsers.Surround.Query
                 }
                 else
                 {
-                    return "Operator " + OperatorName + " does not allow subquery " + dsq.ToString();
+                    return "Operator " + OperatorName + " does not allow subquery " + leq.ToString();
                 }
             }
             return null; /* subqueries acceptable */


Mime
View raw message