diff --git a/MacPass/Base.lproj/DatabaseSettingsWindow.xib b/MacPass/Base.lproj/DatabaseSettingsWindow.xib index 683f95ee..945608af 100644 --- a/MacPass/Base.lproj/DatabaseSettingsWindow.xib +++ b/MacPass/Base.lproj/DatabaseSettingsWindow.xib @@ -1,8 +1,8 @@ - + - + @@ -37,7 +37,7 @@ - + diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 9fcb5cba..efa5acd8 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -287,11 +287,12 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey - (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error{ self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password key:keyFileURL]; self.tree = [[KPKTree alloc] initWithData:self.encryptedData password:self.compositeKey error:error]; - /* clear out the encrypted data as we do not need it for now */ - self.encryptedData = nil; BOOL isUnlocked = (nil != self.tree); + if(isUnlocked) { + /* only clear the data if we actually do not need it anymore */ + self.encryptedData = nil; self.unlockCount += 1; [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidUnlockDatabaseNotification object:self]; /* Make sure to only store */ diff --git a/MacPass/MPPasswordInputController.m b/MacPass/MPPasswordInputController.m index 0527d66f..cf0756c2 100644 --- a/MacPass/MPPasswordInputController.m +++ b/MacPass/MPPasswordInputController.m @@ -87,13 +87,13 @@ #pragma mark - #pragma mark Private - (IBAction)_decrypt:(id)sender { - MPDocument *document = [[self windowController] document]; + MPDocument *document = self.windowController.document; if(document) { NSError *error = nil; /* No password is different than an empty password */ - NSString *password = self.enablePassword ? [self.passwordTextField stringValue] : nil; + NSString *password = self.enablePassword ? self.passwordTextField.stringValue : nil; if(![document unlockWithPassword:password - keyFileURL:[self.keyPathControl URL] + keyFileURL:self.keyPathControl.URL error:&error]) { [self _showError:error]; [[[self view] window] shakeWindow:nil];