Skip to content

Commit

Permalink
Fix null pointer exception in restore VM
Browse files Browse the repository at this point in the history
  • Loading branch information
vishesh92 committed Apr 17, 2024
1 parent 44b8d3a commit 54c5f67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -7700,8 +7700,8 @@ public UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException,
_accountMgr.checkAccess(caller, null, true, vm);

DiskOffering diskOffering = rootDiskOfferingId != null ? validateAndGetDiskOffering(rootDiskOfferingId, vm, caller) : null;
VMTemplateVO template = _templateDao.findById(newTemplateId);
if (template.getSize() != null) {
VMTemplateVO template = _templateDao.findById(newTemplateId != null ? newTemplateId : vm.getTemplateId());
if (template != null && template.getSize() != null) {
String rootDiskSize = details.get(VmDetailConstants.ROOT_DISK_SIZE);
Long templateSize = template.getSize();
if (StringUtils.isNumeric(rootDiskSize)) {
Expand Down

0 comments on commit 54c5f67

Please sign in to comment.