From 36e493101a216a7bef757d5cd027b4bdd55837da Mon Sep 17 00:00:00 2001 From: michael starke Date: Sat, 30 Nov 2013 19:31:32 +0100 Subject: [PATCH] Fixed error that resulted in always trying to save a key file even if none was used --- KeePassKit | 2 +- MacPass/MPDocument.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/KeePassKit b/KeePassKit index 1b9226ec..1e2dead0 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 1b9226eca278fd6106bfda8d42163c1854c7fefe +Subproject commit 1e2dead025183eabc492c84b79dad3167728b9d9 diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 2837c193..64c84d15 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -250,7 +250,7 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { if(isUnlocked) { [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidUnlockDatabaseNotification object:self]; /* Make sure to only store */ - if(self.compositeKey.hasPassword && self.isAllowedToStoreKeyFile) { + if(self.compositeKey.hasKeyFile && self.compositeKey.hasPassword && self.isAllowedToStoreKeyFile) { [self _storeKeyURL:keyFileURL]; } } @@ -565,6 +565,9 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { } - (void)_storeKeyURL:(NSURL *)keyURL { + if(nil == keyURL) { + return; // no URL to store in the first place + } NSAssert(self.isAllowedToStoreKeyFile, @"We can only store if we are allowed to do so!"); NSMutableDictionary *keysForFiles = [[[NSUserDefaults standardUserDefaults] dictionaryForKey:kMPSettingsKeyRememeberdKeysForDatabases] mutableCopy]; if(nil == keysForFiles) {