diff --git a/KeePassKit b/KeePassKit index c5368d2d..22cd576d 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit c5368d2d8b2f6bcdae5a6f9800842a25402c7546 +Subproject commit 22cd576d7cbec4ccd6e0cf07d9f10c3d242c988a diff --git a/MacPass/MPAutotypeCommand.m b/MacPass/MPAutotypeCommand.m index 3bb2c8b9..16175496 100644 --- a/MacPass/MPAutotypeCommand.m +++ b/MacPass/MPAutotypeCommand.m @@ -96,7 +96,7 @@ if(![context isValid]) { return nil; } - NSUInteger reserverd = [context.normalizedCommand length] / 4; + NSUInteger reserverd = MAX(1,[context.normalizedCommand length] / 4); NSMutableArray *commands = [[NSMutableArray alloc] initWithCapacity:reserverd]; NSMutableArray __block *commandRanges = [[NSMutableArray alloc] initWithCapacity:reserverd]; NSRegularExpression *commandRegExp = [[NSRegularExpression alloc] initWithPattern:@"\\{[^\\}]+\\}" options:NSRegularExpressionCaseInsensitive error:0]; diff --git a/MacPass/MPDocument+Autotype.m b/MacPass/MPDocument+Autotype.m index 2aa452a3..6d711986 100644 --- a/MacPass/MPDocument+Autotype.m +++ b/MacPass/MPDocument+Autotype.m @@ -35,7 +35,7 @@ return nil; } NSArray *autotypeEntries = [self.root autotypeableChildEntries]; - NSMutableArray *contexts = [[NSMutableArray alloc] initWithCapacity:ceil([autotypeEntries count] / 4.0)]; + NSMutableArray *contexts = [[NSMutableArray alloc] initWithCapacity:MAX(1,ceil([autotypeEntries count] / 4.0))]; for(KPKEntry *entry in autotypeEntries) { /* Test for title */ NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];