diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m index c25a57e8..0fc14209 100644 --- a/MacPass/MPAppDelegate.m +++ b/MacPass/MPAppDelegate.m @@ -148,7 +148,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename { _shouldOpenFile = YES; NSURL *fileURL = [NSURL fileURLWithPath:filename]; - [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:YES completionHandler:nil]; + [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:fileURL display:YES completionHandler:^(NSDocument * _Nullable document, BOOL documentWasAlreadyOpen, NSError * _Nullable error){}]; return YES; } diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 5eedd39b..dc004cf0 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -355,17 +355,21 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; - (void)tableView:(NSTableView *)tableView didRemoveRowView:(NSTableRowView *)rowView forRow:(NSInteger)row { /* Rows being removed for data change should be checked here to clear selections */ if(row == -1) { - [self tableViewSelectionDidChange:nil]; + [self tableViewSelectionDidChange:[NSNotification notificationWithName:NSTableViewSelectionDidChangeNotification object:tableView]]; } } - (void)tableViewSelectionDidChange:(NSNotification *)notification { - MPDocument *document = [[self windowController] document]; - if([self.entryTable selectedRow] < 0 || [[_entryTable selectedRowIndexes] count] > 1) { + NSTableView *tableView = notification.object; + if(tableView != self.entryTable) { + return; // Not the right table view + } + MPDocument *document = self.windowController.document; + if(tableView.selectedRow < 0 || tableView.selectedRowIndexes.count > 1) { document.selectedEntry = nil; } else { - document.selectedEntry = [self.entryArrayController arrangedObjects][[self.entryTable selectedRow]]; + document.selectedEntry = self.entryArrayController.arrangedObjects[tableView.selectedRow]; } }