fix: NPE with custom networks on shutdown.
Fixes
@@ -126,9 +126,13 @@ public class StopMojo extends AbstractDockerMojo {
for (ImageConfiguration image : getResolvedImages()) {
final NetworkConfig config = image.getRunConfiguration().getNetworkingConfig();
+ if (!config.isCustomNetwork() || config.getName() == null) {
+ continue;
+ }
final Network network = getNetworkByName(networks, config.getCustomNetwork());
-
- if (config.isCustomNetwork() && network != null) {
+ if (network == null) {
+ continue;
+ }
customNetworks.add(network);
Collection<Container> existingContainers =
ContainerNamingUtil.getContainersToStop(image,
@@ -143,7 +147,6 @@ public class StopMojo extends AbstractDockerMojo {
}
}
}
- }
return customNetworks;
}
