diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index a4996c9a7e..e5aa75acd7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -1493,7 +1493,11 @@ public class ApplicationManagerImpl implements ApplicationManager { List appUnrestrictedRoles = this.visibilityDAO.getUnrestrictedRoles(applicationId, tenantId); boolean isExistingAppRestricted = !appUnrestrictedRoles.isEmpty(); - boolean isUpdatingAppRestricted = !applicationUpdateWrapper.getUnrestrictedRoles().isEmpty(); + boolean isUpdatingAppRestricted = false; + if (applicationUpdateWrapper.getUnrestrictedRoles() != null && !applicationUpdateWrapper + .getUnrestrictedRoles().isEmpty()) { + isUpdatingAppRestricted = true; + } if (isExistingAppRestricted && !isUpdatingAppRestricted) { visibilityDAO.deleteUnrestrictedRoles(appUnrestrictedRoles, applicationId, tenantId);