From 91ee6753803d00f63d17c1845fdc1f4cdd788be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 23 Jan 2013 10:14:17 +0100 Subject: [PATCH] Added some null checks. --- .../ConvertToInitializer/StatementsToInitializerConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertToInitializer/StatementsToInitializerConverter.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertToInitializer/StatementsToInitializerConverter.cs index 6943c5416b..72ece66116 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertToInitializer/StatementsToInitializerConverter.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ConvertToInitializer/StatementsToInitializerConverter.cs @@ -357,7 +357,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring bool VariableHasBeenConverted(IVariable variable) { - return accessPaths.Any(item => item.Key.VariableRoot.Equals(variable)); + if (variable == null) + throw new ArgumentNullException("variable"); + return accessPaths.Any(item => item.Key != null && item.Key.VariableRoot != null && item.Key.VariableRoot.Equals(variable)); } bool InsertImplicitInitializersForPath(AccessPath path)