Skip to content

Commit 5cf8064

Browse files
authored
Fix: Prevent NPE on disk offering search while listing VMs (#6287)
1 parent 56fb7ac commit 5cf8064

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/src/main/java/com/cloud/api/ApiDBUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,11 @@ public static DiskOfferingVO findComputeOnlyDiskOfferingById(Long diskOfferingId
10521052
}
10531053

10541054
public static DiskOfferingVO findDiskOfferingById(Long diskOfferingId) {
1055+
if (diskOfferingId == null) {
1056+
return null;
1057+
}
10551058
DiskOfferingVO off = s_diskOfferingDao.findByIdIncludingRemoved(diskOfferingId);
1056-
if (!off.isComputeOnly()) {
1059+
if (off != null && !off.isComputeOnly()) {
10571060
return off;
10581061
}
10591062
return null;

0 commit comments

Comments
 (0)