Skip to content

Commit ff77689

Browse files
fix npe #5179
1 parent a8d33cc commit ff77689

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/util/ValidationUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.HashMap;
1818
import java.util.HashSet;
1919
import java.util.Map;
20+
import java.util.Objects;
2021
import java.util.Set;
2122
import java.util.regex.Matcher;
2223
import java.util.regex.Pattern;
@@ -137,10 +138,8 @@ public static void validateSpringCloudAppName(final String name, final SpringClo
137138
throw new IllegalArgumentException(message("springCloud.app.name.validate.empty"));
138139
} else if (!name.matches(SPRING_CLOUD_APP_NAME_PATTERN)) {
139140
throw new IllegalArgumentException(message("springCloud.app.name.validate.invalid"));
140-
} else {
141-
if (cluster.app(name).exists()) {
142-
throw new IllegalArgumentException(message("springCloud.app.name.validate.exist", name));
143-
}
141+
} else if (Objects.nonNull(cluster) && cluster.app(name).exists()) {
142+
throw new IllegalArgumentException(message("springCloud.app.name.validate.exist", name));
144143
}
145144
}
146145

0 commit comments

Comments
 (0)