server: fix comparison using nullable objects (#4256)

This PR fix some wrongs comparison using nullable objects. Preventing null pointer exception
This commit is contained in:
Rodrigo D. Lopez 2020-08-13 06:05:23 -04:00 committed by GitHub
parent 7bbb4d4bef
commit 6704ef2794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2199,7 +2199,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
// OfflineVmwareMigration: check storage tags on disk(offering)s in comparison to destination storage pool
// OfflineVmwareMigration: if no match return a proper error now
DiskOfferingVO diskOffering = _diskOfferingDao.findById(vol.getDiskOfferingId());
if (diskOffering.equals(null)) {
if (diskOffering == null) {
throw new CloudRuntimeException("volume '" + vol.getUuid() + "', has no diskoffering. Migration target cannot be checked.");
}
if (!doesTargetStorageSupportDiskOffering(destPool, diskOffering)) {