From ad4d7a453fddb2ceb6bd1a67593fb8f151ed6182 Mon Sep 17 00:00:00 2001 From: charitha Date: Thu, 14 Jan 2021 14:41:20 +0530 Subject: [PATCH] Fix NPE occur when updating device with null status --- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index fe35fd51d53..769aad8583a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -457,6 +457,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv if (device.getEnrolmentInfo().getId() == 0) { device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); } + if (device.getEnrolmentInfo().getStatus() == null) { + device.getEnrolmentInfo().setStatus(currentDevice.getEnrolmentInfo().getStatus()); + } if (device.getName() == null) { device.setName(currentDevice.getName()); }