From 2c1eb616827f9588d87f43dd8434da3f1d3ce133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Thunstro=CC=88m?= Date: Thu, 21 Apr 2016 00:27:33 +0200 Subject: [PATCH] Bugfix & add check for whether to use custom string or not Remove local scope variable hiding the one in function scope. Also did not check for the state of the custom characters button. --- MacPass/NSString+MPPasswordCreation.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MacPass/NSString+MPPasswordCreation.m b/MacPass/NSString+MPPasswordCreation.m index 1ab8c9c0..ad09ebfc 100644 --- a/MacPass/NSString+MPPasswordCreation.m +++ b/MacPass/NSString+MPPasswordCreation.m @@ -106,13 +106,13 @@ static NSString *mergeWithoutDuplicates(NSString* baseCharacters, NSString* cust - (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters { NSString *characters = nil; - if(nil == customCharacters) { - characters = allowedCharactersString(allowedCharacters); + if([[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyPasswordUseCustomString] && nil != customCharacters) { + characters = mergeWithoutDuplicates( + allowedCharactersString(allowedCharacters), + customCharacters); } else { - NSString *characters = mergeWithoutDuplicates( - allowedCharactersString(allowedCharacters), - customCharacters); + characters = allowedCharactersString(allowedCharacters); } CGFloat alphabetCount = characters.length; CGFloat passwordLength = self.length;