Fix NRE on cancel when there's nothing to cancel.
This commit is contained in:
parent
91db665428
commit
e787d33e5a
1 changed files with 4 additions and 2 deletions
|
|
@ -212,7 +212,8 @@ namespace LibationWinForms.ProcessQueue
|
||||||
private async void cancelAllBtn_Click(object sender, EventArgs e)
|
private async void cancelAllBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Queue.ClearQueue();
|
Queue.ClearQueue();
|
||||||
await Queue.Current?.CancelAsync();
|
if (Queue.Current is not null)
|
||||||
|
await Queue.Current.CancelAsync();
|
||||||
virtualFlowControl2.VirtualControlCount = Queue.Count;
|
virtualFlowControl2.VirtualControlCount = Queue.Count;
|
||||||
UpdateAllControls();
|
UpdateAllControls();
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +332,8 @@ namespace LibationWinForms.ProcessQueue
|
||||||
ProcessBook item = Queue[queueIndex];
|
ProcessBook item = Queue[queueIndex];
|
||||||
if (buttonName == nameof(panelClicked.cancelBtn))
|
if (buttonName == nameof(panelClicked.cancelBtn))
|
||||||
{
|
{
|
||||||
await item.CancelAsync();
|
if (item is not null)
|
||||||
|
await item.CancelAsync();
|
||||||
Queue.RemoveQueued(item);
|
Queue.RemoveQueued(item);
|
||||||
virtualFlowControl2.VirtualControlCount = Queue.Count;
|
virtualFlowControl2.VirtualControlCount = Queue.Count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue