Fixed isse with entries being added while no group is selected.

This commit is contained in:
michael starke
2014-12-04 02:00:03 +01:00
parent 431b4dd455
commit 249875fb7f

View File

@@ -403,7 +403,14 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
- (void)_didAddItem:(NSNotification *)notification {
MPDocument *document = [[self windowController] document];
if(!document.selectedGroup) {
/* TODO: show group? */
return; // No group selected
}
KPKEntry *entry = document.selectedGroup.entries.lastObject;
if(!entry) {
return; // No Entry found, nothing to select.
}
NSUInteger row = [self.entryArrayController.arrangedObjects indexOfObject:entry];
[self.entryTable scrollRowToVisible:row];
[self.entryTable selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];