ONOS-4395 Fix NPE in OpenFlowDeviceProvider

Change-Id: I88c3671fa490cf978485267a104bf2bcc0f57e58
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
index f3dfdff..bb2df35 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -312,6 +312,10 @@
                                                            List<OFPortStatsEntry> entries) {
         HashSet<PortStatistics> stats = Sets.newHashSet();
 
+        if (entries == null) {
+            return Collections.unmodifiableSet(stats);
+        }
+
         for (OFPortStatsEntry entry : entries) {
             try {
                 if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) {
@@ -339,7 +343,6 @@
         }
 
         return Collections.unmodifiableSet(stats);
-
     }
 
     private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener {