Skip to content

Commit 4342580

Browse files
committed
api: Fix NullPointerException in ApiResponseHelper for DomainResponse
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 22ee420 commit 4342580

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎server/src/com/cloud/api/ApiResponseHelper.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ public DomainResponse createDomainResponse(Domain domain) {
440440
domainResponse.setId(domain.getUuid());
441441
domainResponse.setLevel(domain.getLevel());
442442
domainResponse.setNetworkDomain(domain.getNetworkDomain());
443-
domainResponse.setParentDomainId(ApiDBUtils.findDomainById(domain.getParent()).getUuid());
443+
Domain parentDomain = ApiDBUtils.findDomainById(domain.getParent());
444+
if (parentDomain != null) {
445+
domainResponse.setParentDomainId(parentDomain.getUuid());
446+
}
444447
StringBuilder domainPath = new StringBuilder("ROOT");
445448
(domainPath.append(domain.getPath())).deleteCharAt(domainPath.length() - 1);
446449
domainResponse.setPath(domainPath.toString());

0 commit comments

Comments
 (0)