CA-226112: Disable PVS read caching causes System.NullReferenceException

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2016-10-20 14:52:51 +01:00
parent 1040027a6d
commit 994ced8388
2 changed files with 2 additions and 5 deletions

View File

@ -97,8 +97,7 @@ namespace XenAdmin.Commands
/// <returns></returns> /// <returns></returns>
private AsyncAction GetAsyncActionForVm(VM vm) private AsyncAction GetAsyncActionForVm(VM vm)
{ {
var pvsProxy = vm.Connection.Cache.PVS_proxies.FirstOrDefault(p => p.VM.Equals(vm)); // null if no proxy var pvsProxy = vm.PvsProxy;
if (pvsProxy == null) return null; // No proxy to disable if (pvsProxy == null) return null; // No proxy to disable
return new PvsProxyDestroyAction(pvsProxy); return new PvsProxyDestroyAction(pvsProxy);

View File

@ -139,9 +139,7 @@ namespace XenAdmin.Dialogs
/// <returns></returns> /// <returns></returns>
private bool PvsProxyAlreadyEnabled(VM vm) private bool PvsProxyAlreadyEnabled(VM vm)
{ {
var pvsProxies = vm.Connection.Cache.PVS_proxies; return vm.PvsProxy != null;
return pvsProxies.Any(pvsProxy => pvsProxy.VM.Equals(vm));
} }
/// <summary> /// <summary>