Merge pull request #419 from stephen-turner/CA-165096

CA-165096: Add null reference check
This commit is contained in:
Stephen Turner 2015-03-27 16:31:53 +00:00
commit fe97f617ca

View File

@ -359,7 +359,7 @@ namespace XenAdmin.ConsoleView
XenAPI.Network network = vif.Connection.Resolve(vif.network); XenAPI.Network network = vif.Connection.Resolve(vif.network);
XenAPI.Host host = vm.Connection.Resolve(vm.resident_on); XenAPI.Host host = vm.Connection.Resolve(vm.resident_on);
XenAPI.PIF pif = Helpers.FindPIF(network, host); XenAPI.PIF pif = Helpers.FindPIF(network, host);
if (pif.LinkStatus == PIF.LinkState.Connected) if (pif != null && pif.LinkStatus == PIF.LinkState.Connected)
{ {
foreach (var networkInfo in networks.Where(n => n.Key.StartsWith(String.Format("{0}/ip", vif.device)))) foreach (var networkInfo in networks.Where(n => n.Key.StartsWith(String.Format("{0}/ip", vif.device))))
{ {