From e72249bf68c756995abfa9b6ad6b02f1f7922d83 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Sun, 15 Nov 2015 23:29:57 -0800 Subject: [PATCH] #582 VS 2013 Crash NullReferenceException - it was sometimes possible for one of the children in moduleTree to be null. Check for null before mod.Name string comparison. --- Nodejs/Product/Analysis/Analysis/ModuleTreeExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nodejs/Product/Analysis/Analysis/ModuleTreeExtensions.cs b/Nodejs/Product/Analysis/Analysis/ModuleTreeExtensions.cs index d08542c45..5c118ab62 100644 --- a/Nodejs/Product/Analysis/Analysis/ModuleTreeExtensions.cs +++ b/Nodejs/Product/Analysis/Analysis/ModuleTreeExtensions.cs @@ -28,7 +28,7 @@ internal static IEnumerable GetChildrenExcludingNodeModules(this Mod // The process of resolving modules can lead us to add entries into the underlying array // doing so results in exceptions b/c the array has changed under the enumerable // To avoid this, we call .ToArray() to create a copy of the array locally which we then Enumerate - return moduleTree.Children.Values.ToArray().Where(mod => !String.Equals(mod.Name, AnalysisConstants.NodeModulesFolder, StringComparison.OrdinalIgnoreCase)); + return moduleTree.Children.Values.ToArray().Where(mod => mod != null && !String.Equals(mod.Name, AnalysisConstants.NodeModulesFolder, StringComparison.OrdinalIgnoreCase)); } } }