Fixed #392. Wrongfully cleared internal data on failed password input.

Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
michael starke
2015-12-04 12:31:32 +01:00
parent 366d6f9734
commit 569d8a700d
3 changed files with 9 additions and 8 deletions

View File

@@ -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];