Skip to content

Commit f5ceb4a

Browse files
committed
fix: throw explicit exception instead of letting NPE go through
1 parent 2818b49 commit f5ceb4a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ControllerConfiguration.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ static boolean currentNamespaceWatched(Set<String> namespaces) {
4444
default Set<String> getEffectiveNamespaces() {
4545
var targetNamespaces = getNamespaces();
4646
if (watchCurrentNamespace()) {
47-
targetNamespaces =
48-
Collections.singleton(getConfigurationService().getClientConfiguration().getNamespace());
47+
final var parent = getConfigurationService();
48+
if (parent == null) {
49+
throw new IllegalStateException(
50+
"Parent ConfigurationService must be set before calling this method");
51+
}
52+
targetNamespaces = Collections.singleton(parent.getClientConfiguration().getNamespace());
4953
}
5054
return targetNamespaces;
5155
}

0 commit comments

Comments
 (0)