diff options
author | Damiano Galassi <[email protected]> | 2021-01-30 21:48:49 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2021-01-30 21:48:49 +0100 |
commit | e78f1d70ebae90a8fd0f37d6ba08146a5b73f883 (patch) | |
tree | 4a966fa6cdb67d999d495bb724abfc2f8f66088e /macosx/HBQueueController.m | |
parent | a5c06736044ddad908d6ee730babf8335ac1342b (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.m | 17 |
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; } }]; } |