mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
CP-36392: Add null
check to connection
call in ExternalPluginAction.cs
Also remove `null` check that always resolves to true Also tidy up code Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
44c9416745
commit
0ffee712b7
@ -246,11 +246,11 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
|
||||
// Returns a set of params which relate to the object you have selected in the treeview
|
||||
private List<string> RetrieveParams(IXenObject obj)
|
||||
private IEnumerable<string> RetrieveParams(IXenObject obj)
|
||||
{
|
||||
IXenConnection connection = obj.Connection;
|
||||
Host coordinator = connection != null ? Helpers.GetCoordinator(connection) : null; // get coordinator asserts connection is not null
|
||||
string coordinatorAddress = EmptyParameter;
|
||||
var connection = obj.Connection;
|
||||
var coordinator = connection != null ? Helpers.GetCoordinator(connection) : null; // get coordinator asserts connection is not null
|
||||
var coordinatorAddress = EmptyParameter;
|
||||
|
||||
if (coordinator != null)
|
||||
{
|
||||
@ -258,9 +258,9 @@ namespace XenAdmin.Actions
|
||||
WriteTrustedCertificates(coordinator.Connection);
|
||||
}
|
||||
|
||||
string sessionRef = connection.Session != null ? connection.Session.opaque_ref : EmptyParameter;
|
||||
string objCls = obj != null ? obj.GetType().Name : EmptyParameter;
|
||||
string objUuid = obj != null && connection.Session != null ? Helpers.GetUuid(obj) : EmptyParameter;
|
||||
var sessionRef = connection?.Session != null ? connection.Session.opaque_ref : EmptyParameter;
|
||||
var objCls = obj.GetType().Name;
|
||||
var objUuid = connection?.Session != null ? Helpers.GetUuid(obj) : EmptyParameter;
|
||||
return new List<string>(new string[] { coordinatorAddress, sessionRef, objCls, objUuid });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user