From 6ca7ee6c780821a31ca3dc27e86528bca824903a Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 25 Mar 2015 19:35:26 +0530 Subject: [PATCH] Fixing NPE thrown while shutting down the MDM server --- .../MobileDeviceManagementServiceComponent.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java index 1dc22c9773..69131f4ed0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java @@ -102,10 +102,15 @@ public class MobileDeviceManagementServiceComponent { log.debug("De-activating Mobile Device Management Service Component"); } try { - androidServiceRegRef.unregister(); - iOSServiceRegRef.unregister(); - windowsServiceRegRef.unregister(); - serverStartupObserverRef.unregister(); + if (androidServiceRegRef != null) { + androidServiceRegRef.unregister(); + } + if (iOSServiceRegRef != null) { + iOSServiceRegRef.unregister(); + } + if (windowsServiceRegRef != null) { + windowsServiceRegRef.unregister(); + } if (log.isDebugEnabled()) { log.debug(