Skip to content

Commit 1cf165f

Browse files
committed
ApiResponseHelper: fix NPE when parent of snapshot is null
1 parent ca0a770 commit 1cf165f

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
@@ -500,7 +500,10 @@ public VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot) {
500500
vmSnapshotResponse.setVirtualMachineid(vm.getUuid());
501501
}
502502
if (vmSnapshot.getParent() != null) {
503-
vmSnapshotResponse.setParentName(ApiDBUtils.getVMSnapshotById(vmSnapshot.getParent()).getDisplayName());
503+
VMSnapshot vmSnapshotParent = ApiDBUtils.getVMSnapshotById(vmSnapshot.getParent());
504+
if (vmSnapshotParent != null) {
505+
vmSnapshotResponse.setParentName(vmSnapshotParent.getDisplayName());
506+
}
504507
}
505508
vmSnapshotResponse.setCurrent(vmSnapshot.getCurrent());
506509
vmSnapshotResponse.setType(vmSnapshot.getType().toString());

0 commit comments

Comments
 (0)