From fa967383d60a99154beca859ff212a10ce18c518 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 7 Dec 2018 18:53:56 +0100 Subject: [PATCH] Fix for exception when userdata method call does not exist --- Upsilon/Binder/Binder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Upsilon/Binder/Binder.cs b/Upsilon/Binder/Binder.cs index c08a717..898aa7d 100644 --- a/Upsilon/Binder/Binder.cs +++ b/Upsilon/Binder/Binder.cs @@ -281,9 +281,12 @@ namespace Upsilon.Binder } else if (resolved is UserDataVariableSymbol udSymbol) { - if (udSymbol.Parent != null && udSymbol.Parent.Properties[resolved.Name] is UserDataBoundMethod ubMethod) + if (udSymbol.Parent != null ) { - returnType = ubMethod.ResultType; + if (udSymbol.Parent.Properties.TryGetValue(resolved.Name, out var ubProperty) && ubProperty is UserDataBoundMethod ubMethod) + { + returnType = ubMethod.ResultType; + } } } return new BoundFunctionCallExpression(expression, parameters.ToImmutable(), e.Span, returnType);