auto test: protect from NPE
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Tue, 22 Mar 2016 11:44:37 +0000 (14:44 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Tue, 22 Mar 2016 11:44:37 +0000 (14:44 +0300)
platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java

index f817967cf63fd6a684219c3299919e94847d19d9..fc00a8e667e801a925d537fc6f6fb1973916b4ce 100644 (file)
@@ -253,12 +253,15 @@ public class AutoTestManager implements PersistentStateComponent<AutoTestManager
   public void loadState(State state) {
     List<RunConfiguration> configurations = ContainerUtil.newArrayList();
     RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
-    for (RunConfigurationDescriptor descriptor : state.myEnabledRunConfigurations) {
-      RunnerAndConfigurationSettings settings = runManager.findConfigurationByTypeAndName(descriptor.myType,
-                                                                                          descriptor.myName);
-      RunConfiguration configuration = settings != null ? settings.getConfiguration() : null;
-      if (configuration != null) {
-        configurations.add(configuration);
+    List<RunConfigurationDescriptor> descriptors = ContainerUtil.notNullize(state.myEnabledRunConfigurations);
+    for (RunConfigurationDescriptor descriptor : descriptors) {
+      if (descriptor.myType != null && descriptor.myName != null) {
+        RunnerAndConfigurationSettings settings = runManager.findConfigurationByTypeAndName(descriptor.myType,
+                                                                                            descriptor.myName);
+        RunConfiguration configuration = settings != null ? settings.getConfiguration() : null;
+        if (configuration != null) {
+          configurations.add(configuration);
+        }
       }
     }
     myEnabledRunProfiles.clear();