summaryrefslogtreecommitdiffstats
path: root/macosx/HBQueueController.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2021-01-30 21:48:49 +0100
committerDamiano Galassi <[email protected]>2021-01-30 21:48:49 +0100
commite78f1d70ebae90a8fd0f37d6ba08146a5b73f883 (patch)
tree4a966fa6cdb67d999d495bb724abfc2f8f66088e /macosx/HBQueueController.m
parenta5c06736044ddad908d6ee730babf8335ac1342b (diff)
MacGUI: prevent a possible exception if a job being rescanned is manually deleted from the queue before the rescan is done.
Diffstat (limited to 'macosx/HBQueueController.m')
-rw-r--r--macosx/HBQueueController.m17
1 files changed, 12 insertions, 5 deletions
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index d972a1896..6c49a7621 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -356,15 +356,22 @@
[self.delegate openJob:[item.job copy] completionHandler:^(BOOL result) {
NSInteger index = [self.queue.items indexOfObject:item];
- [self.queue resetItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
- if (result)
+ if (index != NSNotFound)
{
- // Now that source is loaded and settings applied, delete the queue item from the queue
- [self.queue removeItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ [self.queue resetItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ if (result)
+ {
+ // Now that source is loaded and settings applied, delete the queue item from the queue
+ [self.queue removeItemsAtIndexes:[NSIndexSet indexSetWithIndex:index]];
+ }
+ else
+ {
+ NSBeep();
+ }
}
else
{
- NSBeep();
+ item.state = HBQueueItemStateReady;
}
}];
}