From c9e82672d894581367e169d3a49a37b85e015305 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 7 Jun 2010 18:19:56 +0000 Subject: [PATCH] added additional null checking - possible fix for ExceptionGroupId 126 git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5920 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../XamlBinding/XamlBinding/CompletionDataHelper.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs index 2fef80ef74..388199984f 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs @@ -263,12 +263,15 @@ namespace ICSharpCode.XamlBinding return emptyList; if (lastElement.LocalName.EndsWith(".", StringComparison.OrdinalIgnoreCase) || context.PressedKey == '.') { + if (rt == null) + return list; + string key = string.IsNullOrEmpty(lastElement.Prefix) ? "" : lastElement.Prefix + ":"; - + if (context.ParentElement.LocalName.StartsWith(lastElement.LocalName.TrimEnd('.'), StringComparison.OrdinalIgnoreCase)) { AddAttributes(rt, list, includeEvents); AddAttachedProperties(rt.GetUnderlyingClass(), list, key, lastElement.Name.Trim('.')); - } else if (rt != null && rt.GetUnderlyingClass() != null) + } else AddAttachedProperties(rt.GetUnderlyingClass(), list, key, lastElement.Name.Trim('.')); } else { if (rt == null) { @@ -1283,6 +1286,9 @@ namespace ICSharpCode.XamlBinding public static void AddAttachedProperties(IClass c, List result, string key, string prefix) { + if (c == null) + return; + var attachedProperties = c.Fields.Where(f => f.IsAttached(true, false)); int prefixLength = (prefix.Length > 0) ? prefix.Length + 1 : 0;