adium/adium

45a222d15932
Parents a2d01504eb3b
Children 9b51ee404bc6
Prevent via an @catch/@try/@finally bandaid #16121. Fixes #16121
--- a/Source/AILogViewerWindowController.m Thu Sep 06 21:01:42 2012 +0200
+++ b/Source/AILogViewerWindowController.m Wed Sep 05 18:25:04 2012 -0500
@@ -497,7 +497,7 @@
}
}
--(void)rebuildIndices
+- (void)rebuildIndices
{
//Rebuild the 'global' log indexes
[logFromGroupDict release]; logFromGroupDict = [[NSMutableDictionary alloc] init];
@@ -1927,16 +1927,27 @@
- (void)tableViewSelectionDidChangeDelayed
{
if (!ignoreSelectionChange) {
- NSArray *selectedLogs;
+ NSArray *selectedLogs = nil;
//Update the displayed log
automaticSearch = NO;
[resultsLock lock];
- selectedLogs = [tableView_results selectedItemsFromArray:currentSearchResults];
+ @try {
+ /* If currentSearchResults is out of sync with the data of tableView_results, this could throw an exception.
+ * Catching it is far more straightforward than preventing that possibility without breaking our re-selection of
+ * selected search results as the table view reloads when new results come in.
+ */
+ selectedLogs = [tableView_results selectedItemsFromArray:currentSearchResults];
+ } @catch (NSException *e) {
+
+ } @finally {
+
+ }
[resultsLock unlock];
- [self displayLogs:selectedLogs];
+ if (selectedLogs)
+ [self displayLogs:selectedLogs];
}
}