lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/2] lucenenet git commit: Fix a KeyNotFound exception
Date Sat, 31 Jan 2015 22:19:46 GMT
Fix a KeyNotFound exception


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

Branch: refs/heads/master
Commit: d463487ccec393fdfae491a85a76e293fc6d2b7d
Parents: 2fcf7d2
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Feb 1 00:19:24 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Feb 1 00:19:24 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Expressions/SimpleBindings.cs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d463487c/src/Lucene.Net.Expressions/SimpleBindings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/SimpleBindings.cs b/src/Lucene.Net.Expressions/SimpleBindings.cs
index f317970..92dfc9f 100644
--- a/src/Lucene.Net.Expressions/SimpleBindings.cs
+++ b/src/Lucene.Net.Expressions/SimpleBindings.cs
@@ -59,16 +59,18 @@ namespace Lucene.Net.Expressions
 
 		public override ValueSource GetValueSource(string name)
 		{
-		    object o = map[name];
-			if (o == null)
+		    object o;
+			if (!map.TryGetValue(name, out o))
 			{
 				throw new ArgumentException("Invalid reference '" + name + "'");
 			}
+
 		    var expression = o as Expression;
 		    if (expression != null)
 		    {
 		        return expression.GetValueSource(this);
 		    }
+
 		    SortField field = (SortField)o;
 			switch (field.Type)
 			{


Mime
View raw message