diff --git a/modules/dcache-chimera/src/main/java/org/dcache/chimera/namespace/PoolInformationBase.java b/modules/dcache-chimera/src/main/java/org/dcache/chimera/namespace/PoolInformationBase.java index ddc63e2627e..b2ff735d395 100644 --- a/modules/dcache-chimera/src/main/java/org/dcache/chimera/namespace/PoolInformationBase.java +++ b/modules/dcache-chimera/src/main/java/org/dcache/chimera/namespace/PoolInformationBase.java @@ -74,13 +74,18 @@ public synchronized PoolInformation getPoolWithHSM(String hsm) { */ public synchronized void remove(String name) { PoolInformation pool = _pools.remove(name); - if (pool != null) { - for (String hsm : pool.getHsmInstances()) { - Collection pools = _hsmToPool.get(hsm); - pools.remove(pool); - if (pools.isEmpty()) { - _hsmToPool.remove(hsm); - } + if (pool == null) { + return; + } + Collection hsms = pool.getHsmInstances(); + if (hsms == null) { + return; + } + for (String hsm : hsms) { + Collection pools = _hsmToPool.get(hsm); + pools.remove(pool); + if (pools.isEmpty()) { + _hsmToPool.remove(hsm); } } }