BUG-6647 Increase code coverage and clean up IV
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / ApplicationPeer.java
index 73fdf42504a408e385c673a9a3429fcc86df7ef8..7ed275f93f3d227b3654db04be7e063101e7b342 100644 (file)
@@ -185,10 +185,18 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
 
     @Override
     public void close() {
-        this.effectiveRibInWriter.close();
-        this.writer.removePeer();
-        this.chain.close();
-        this.writerChain.close();
+        if(this.effectiveRibInWriter != null) {
+            this.effectiveRibInWriter.close();
+        }
+        if(this.writer != null) {
+            this.writer.removePeer();
+        }
+        if(this.chain != null) {
+            this.chain.close();
+        }
+        if(this.writerChain != null) {
+            this.writerChain.close();
+        }
     }
 
     @Override