diff --git a/src/main/java/com/ibm/iotf/devicemgmt/device/ManagedDevice.java b/src/main/java/com/ibm/iotf/devicemgmt/device/ManagedDevice.java index b84c236e..a8030de6 100644 --- a/src/main/java/com/ibm/iotf/devicemgmt/device/ManagedDevice.java +++ b/src/main/java/com/ibm/iotf/devicemgmt/device/ManagedDevice.java @@ -1025,7 +1025,9 @@ public void run() { private void terminate() { running = false; try { - publishQueue.put(dummy); + if(publishQueue != null) { + publishQueue.put(dummy); + } } catch (InterruptedException e) { } } diff --git a/src/main/java/com/ibm/iotf/devicemgmt/gateway/ManagedGateway.java b/src/main/java/com/ibm/iotf/devicemgmt/gateway/ManagedGateway.java index 7a0cac3e..a2770432 100644 --- a/src/main/java/com/ibm/iotf/devicemgmt/gateway/ManagedGateway.java +++ b/src/main/java/com/ibm/iotf/devicemgmt/gateway/ManagedGateway.java @@ -1599,7 +1599,9 @@ public void run() { private void terminate() { running = false; try { - publishQueue.put(dummy); + if(null != publishQueue) { + publishQueue.put(dummy); + } } catch (InterruptedException e) { } }