[Vmware] Prevent NPE on template registration if guest OS is removed (#5980)

This commit is contained in:
Nicolas Vazquez 2022-02-11 07:36:59 -03:00 committed by GitHub
parent 212a4dedfc
commit 7f0a322b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,8 +176,8 @@ public class DeployAsIsHelperImpl implements DeployAsIsHelper {
} else {
if (StringUtils.isNotEmpty(guestOsDescription)) {
for (GuestOSHypervisorVO guestOSHypervisorVO : guestOsMappings) {
GuestOSVO guestOSVO = guestOSDao.findById(guestOSHypervisorVO.getGuestOsId());
if (guestOsDescription.equalsIgnoreCase(guestOSVO.getDisplayName())) {
GuestOSVO guestOSVO = guestOSDao.findByIdIncludingRemoved(guestOSHypervisorVO.getGuestOsId());
if (guestOSVO != null && guestOsDescription.equalsIgnoreCase(guestOSVO.getDisplayName())) {
guestOsId = guestOSHypervisorVO.getGuestOsId();
break;
}