mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
Added some null safety checks.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
80aef805bf
commit
54e341c315
@ -219,12 +219,10 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private delegate List<AsyncAction> GetActionsDelegate();
|
|
||||||
|
|
||||||
private List<AsyncAction> GetRemovePatchActions(List<Pool_patch> patchesToRemove)
|
private List<AsyncAction> GetRemovePatchActions(List<Pool_patch> patchesToRemove)
|
||||||
{
|
{
|
||||||
if (patchesToRemove == null || patchesToRemove.Count == 0)
|
if (patchesToRemove == null || patchesToRemove.Count == 0)
|
||||||
return null;
|
return new List<AsyncAction>();
|
||||||
|
|
||||||
List<AsyncAction> list = new List<AsyncAction>();
|
List<AsyncAction> list = new List<AsyncAction>();
|
||||||
foreach (Pool_patch patch in patchesToRemove)
|
foreach (Pool_patch patch in patchesToRemove)
|
||||||
@ -252,7 +250,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
private List<AsyncAction> GetRemoveVdiActions(List<VDI> vdisToRemove)
|
private List<AsyncAction> GetRemoveVdiActions(List<VDI> vdisToRemove)
|
||||||
{
|
{
|
||||||
if (vdisToRemove == null || vdisToRemove.Count == 0)
|
if (vdisToRemove == null || vdisToRemove.Count == 0)
|
||||||
return null;
|
return new List<AsyncAction>();
|
||||||
|
|
||||||
var list = (from vdi in vdisToRemove
|
var list = (from vdi in vdisToRemove
|
||||||
where vdi.Connection != null && vdi.Connection.IsConnected
|
where vdi.Connection != null && vdi.Connection.IsConnected
|
||||||
@ -285,10 +283,10 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
base.OnCancel();
|
base.OnCancel();
|
||||||
|
|
||||||
var subActions = new List<AsyncAction>();
|
var subActions = new List<AsyncAction>();
|
||||||
subActions.AddRange(GetUnwindChangesActions(PatchingWizard_PrecheckPage.PrecheckProblemsActuallyResolved));
|
subActions.AddRange(GetUnwindChangesActions(PatchingWizard_PrecheckPage.PrecheckProblemsActuallyResolved) ?? new List<AsyncAction>());
|
||||||
subActions.AddRange(GetRemovePatchActions());
|
subActions.AddRange(GetRemovePatchActions() ?? new List<AsyncAction>());
|
||||||
subActions.AddRange(GetRemoveVdiActions());
|
subActions.AddRange(GetRemoveVdiActions() ?? new List<AsyncAction>());
|
||||||
subActions.AddRange(GetCleanUpPoolUpdateActions());
|
subActions.AddRange(GetCleanUpPoolUpdateActions() ?? new List<AsyncAction>());
|
||||||
|
|
||||||
RunMultipleActions(Messages.REVERT_WIZARD_CHANGES, Messages.REVERTING_WIZARD_CHANGES,
|
RunMultipleActions(Messages.REVERT_WIZARD_CHANGES, Messages.REVERTING_WIZARD_CHANGES,
|
||||||
Messages.REVERTED_WIZARD_CHANGES, subActions);
|
Messages.REVERTED_WIZARD_CHANGES, subActions);
|
||||||
|
@ -44,7 +44,7 @@ namespace XenAdmin.Wizards
|
|||||||
protected List<AsyncAction> GetUnwindChangesActions(List<Problem> problems)
|
protected List<AsyncAction> GetUnwindChangesActions(List<Problem> problems)
|
||||||
{
|
{
|
||||||
if (problems == null)
|
if (problems == null)
|
||||||
return null;
|
return new List<AsyncAction>();
|
||||||
|
|
||||||
var actions = from problem in problems
|
var actions = from problem in problems
|
||||||
where problem.SolutionActionCompleted
|
where problem.SolutionActionCompleted
|
||||||
|
Loading…
Reference in New Issue
Block a user