This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 7f0a322  [Vmware] Prevent NPE on template registration if guest OS is 
removed (#5980)
7f0a322 is described below

commit 7f0a322b7d53fe9961a1e03c93208f3c7bef69df
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Fri Feb 11 07:36:59 2022 -0300

    [Vmware] Prevent NPE on template registration if guest OS is removed (#5980)
---
 .../cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/engine/storage/src/main/java/org/apache/cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java
 
b/engine/storage/src/main/java/org/apache/cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java
index 85185ef..326b6a3 100644
--- 
a/engine/storage/src/main/java/org/apache/cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java
+++ 
b/engine/storage/src/main/java/org/apache/cloudstack/storage/image/deployasis/DeployAsIsHelperImpl.java
@@ -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;
                         }

Reply via email to