Skip to content

Commit

Permalink
TryGetValue instead of ContainsKey and Get (neo-project#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored and erikzhang committed Feb 27, 2018
1 parent 80ea35d commit b1338d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/neo-vm/InteropService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ protected void Register(string method, Func<ExecutionEngine, bool> handler)

internal bool Invoke(string method, ExecutionEngine engine)
{
if (!dictionary.ContainsKey(method)) return false;
return dictionary[method](engine);
if (!dictionary.TryGetValue(method, out Func<ExecutionEngine, bool> func)) return false;
return func(engine);
}

private static bool GetScriptContainer(ExecutionEngine engine)
Expand Down

0 comments on commit b1338d4

Please sign in to comment.