From 5996e6841b84e4d43ed442591fb5055e6344bdc2 Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Thu, 31 Aug 2017 16:56:53 +0530 Subject: [PATCH] Added null check to resolve wso2/product-iots#1367 --- .../device/mgt/core/DeviceManagementPluginRepository.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java index 7a3b487121..4c06d507ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java @@ -350,7 +350,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) { try { DeviceManagementDataHolder.getInstance().removeDeviceStatusTaskPluginConfig(deviceType); - deviceStatusTaskManagerService.stopTask(deviceType, deviceStatusTaskPluginConfig); + if (deviceStatusTaskManagerService != null) { + deviceStatusTaskManagerService.stopTask(deviceType, deviceStatusTaskPluginConfig); + } } catch (DeviceStatusTaskException e) { throw new DeviceManagementException("Error occurred while stopping Device Status task service for '" + deviceManagementService.getType() + "'", e);