fix bug when a device disconnects. Issue was due to null roleinfo in event

Change-Id: I12d371382931ef4ab93f25f32ed6e4786735f55a
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
index 1a57ffb..3c1ec35 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
@@ -143,7 +143,11 @@
         public void event(MastershipEvent event) {
             switch (event.type()) {
                 case MASTER_CHANGED:
-                    setupPipelineHandler(event.subject());
+                    if (event.roleInfo().master() != null) {
+                        setupPipelineHandler(event.subject());
+                    }
+                    break;
+                case BACKUPS_CHANGED:
                     break;
                 default:
                     break;
@@ -158,7 +162,21 @@
             switch (event.type()) {
                 case DEVICE_ADDED:
                 case DEVICE_AVAILABILITY_CHANGED:
-                    setupPipelineHandler(event.subject().id());
+                    if (deviceService.isAvailable(event.subject().id())) {
+                        setupPipelineHandler(event.subject().id());
+                    }
+                    break;
+                case DEVICE_UPDATED:
+                    break;
+                case DEVICE_REMOVED:
+                    break;
+                case DEVICE_SUSPENDED:
+                    break;
+                case PORT_ADDED:
+                    break;
+                case PORT_UPDATED:
+                    break;
+                case PORT_REMOVED:
                     break;
                 default:
                     break;