rhtyd closed pull request #2330: CLOUDSTACK-10144: fix possible NPE in
listVlanIpRanges
URL: https://github.com/apache/cloudstack/pull/2330
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java
b/server/src/com/cloud/api/ApiResponseHelper.java
index 99f1b471265..0081b9d209a 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -2365,12 +2365,18 @@ public static void
populateOwner(ControlledViewEntityResponse response, Controll
private void populateAccount(ControlledEntityResponse response, long
accountId) {
Account account = ApiDBUtils.findAccountById(accountId);
- if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+ if (account == null) {
+ s_logger.debug("Unable to find account with id: " + accountId);
+ } else if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
// find the project
Project project =
ApiDBUtils.findProjectByProjectAccountId(account.getId());
- response.setProjectId(project.getUuid());
- response.setProjectName(project.getName());
- response.setAccountName(account.getAccountName());
+ if (project != null) {
+ response.setProjectId(project.getUuid());
+ response.setProjectName(project.getName());
+ response.setAccountName(account.getAccountName());
+ } else {
+ s_logger.debug("Unable to find project with id: " +
account.getId());
+ }
} else {
response.setAccountName(account.getAccountName());
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services