mirror of https://github.com/apache/cloudstack.git
Fix potential NullPointerException in findStoragePool (VolumeOrchestrator) (#5358)
* fix null pointer exception when vm is null * add null checker to getPreferredStoragePool method Co-authored-by: junxuan <atrocitythemetms@gmail.com>
This commit is contained in:
parent
30aeeb09d2
commit
f6073052aa
|
|
@ -313,7 +313,10 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
}
|
||||
|
||||
private Optional<StoragePool> getPreferredStoragePool(List<StoragePool> poolList, VirtualMachine vm) {
|
||||
String accountStoragePoolUuid = StorageManager.PreferredStoragePool.valueIn(vm.getAccountId());
|
||||
String accountStoragePoolUuid = null;
|
||||
if (vm != null) {
|
||||
accountStoragePoolUuid = StorageManager.PreferredStoragePool.valueIn(vm.getAccountId());
|
||||
}
|
||||
Optional<StoragePool> storagePool = getMatchingStoragePool(accountStoragePoolUuid, poolList);
|
||||
|
||||
if (storagePool.isPresent()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue