diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java index a6c9499575..12ac7ef614 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java @@ -582,9 +582,11 @@ public class AndroidDeviceUtils { throws DeviceManagementException { try { List pendingOperations = getPendingOperations(deviceIdentifier); - for (Operation operation : pendingOperations) { - operation.setStatus(Operation.Status.ERROR); - AndroidAPIUtils.getDeviceManagementService().updateOperation(deviceIdentifier, operation); + if (pendingOperations != null && !pendingOperations.isEmpty()) { + for (Operation operation : pendingOperations) { + operation.setStatus(Operation.Status.ERROR); + AndroidAPIUtils.getDeviceManagementService().updateOperation(deviceIdentifier, operation); + } } } catch (OperationManagementException e) { String msg = "Error occurred while retrieving pending operations to update operation statuses of " +