From 3ec580546401c461d6e4b4bfb8b98c54d7f966b8 Mon Sep 17 00:00:00 2001 From: Jisheng Xing Date: Thu, 22 Feb 2018 18:21:12 +0800 Subject: [PATCH] add some check when resolving a reference --- XenModel/XenAPI-Extensions/PIF.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/XenModel/XenAPI-Extensions/PIF.cs b/XenModel/XenAPI-Extensions/PIF.cs index 30d20f327..772e697ab 100644 --- a/XenModel/XenAPI-Extensions/PIF.cs +++ b/XenModel/XenAPI-Extensions/PIF.cs @@ -57,8 +57,14 @@ namespace XenAPI } else if(sriov_logical_PIF_of.Count != 0) { + if (Connection == null) + return ""; Network_sriov network_s = Connection.Resolve(sriov_logical_PIF_of[0]); + if (network_s == null) + return ""; PIF pif = Connection.Resolve(network_s.physical_PIF); + if (pif == null) + return ""; return pif.Name(); } else