Recheck fields when cleaning up listeners
[yangtools.git] / yang / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / SimpleNamespaceContext.java
index 0442329dd6aaa12b81bceaa82d9fdfa045541ea5..0e619a78d935ba9e022a837c2dbeef36ef9bdba5 100644 (file)
@@ -47,7 +47,7 @@ final class SimpleNamespaceContext<K, V, N extends IdentifierNamespace<K, V>>
 
         if (listeners != null) {
             notifyListeners(storage, listeners.iterator(), value);
-            if (listeners.isEmpty()) {
+            if (listeners != null && listeners.isEmpty()) {
                 listeners = null;
             }
         }
@@ -59,7 +59,7 @@ final class SimpleNamespaceContext<K, V, N extends IdentifierNamespace<K, V>>
                     it.remove();
                 }
             }
-            if (predicateListeners.isEmpty()) {
+            if (predicateListeners != null && predicateListeners.isEmpty()) {
                 predicateListeners = null;
             }
         }