Charles Chan

ONOS-4395 Fix NPE in OpenFlowDeviceProvider

Change-Id: I88c3671fa490cf978485267a104bf2bcc0f57e58
...@@ -312,6 +312,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -312,6 +312,10 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
312 List<OFPortStatsEntry> entries) { 312 List<OFPortStatsEntry> entries) {
313 HashSet<PortStatistics> stats = Sets.newHashSet(); 313 HashSet<PortStatistics> stats = Sets.newHashSet();
314 314
315 + if (entries == null) {
316 + return Collections.unmodifiableSet(stats);
317 + }
318 +
315 for (OFPortStatsEntry entry : entries) { 319 for (OFPortStatsEntry entry : entries) {
316 try { 320 try {
317 if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) { 321 if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) {
...@@ -339,7 +343,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -339,7 +343,6 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
339 } 343 }
340 344
341 return Collections.unmodifiableSet(stats); 345 return Collections.unmodifiableSet(stats);
342 -
343 } 346 }
344 347
345 private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener { 348 private class InternalDeviceProvider implements OpenFlowSwitchListener, OpenFlowEventListener {
......