Skip to content

Commit 0f278c1

Browse files
avoid NPE
1 parent 732495b commit 0f278c1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,6 +3304,9 @@ public void validateCallingUserHasAccessToDesiredUser(Long userId) {
33043304
throw new PermissionDeniedException("Only admins can operate on API keys owned by other users");
33053305
}
33063306
User desiredUser = _userDao.getUser(userId);
3307+
if (desiredUser == null) {
3308+
throw new CloudRuntimeException(String.format("Unable to find user with ID [%s].", userId));
3309+
}
33073310
verifyCallerPrivilegeForUserOrAccountOperations(desiredUser);
33083311
}
33093312

0 commit comments

Comments
 (0)