mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 11:42:30 +00:00
Fixes possible issues with wrong initial capacities
This commit is contained in:
Submodule KeePassKit updated: c5368d2d8b...22cd576d7c
@@ -96,7 +96,7 @@
|
|||||||
if(![context isValid]) {
|
if(![context isValid]) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
NSUInteger reserverd = [context.normalizedCommand length] / 4;
|
NSUInteger reserverd = MAX(1,[context.normalizedCommand length] / 4);
|
||||||
NSMutableArray *commands = [[NSMutableArray alloc] initWithCapacity:reserverd];
|
NSMutableArray *commands = [[NSMutableArray alloc] initWithCapacity:reserverd];
|
||||||
NSMutableArray __block *commandRanges = [[NSMutableArray alloc] initWithCapacity:reserverd];
|
NSMutableArray __block *commandRanges = [[NSMutableArray alloc] initWithCapacity:reserverd];
|
||||||
NSRegularExpression *commandRegExp = [[NSRegularExpression alloc] initWithPattern:@"\\{[^\\}]+\\}" options:NSRegularExpressionCaseInsensitive error:0];
|
NSRegularExpression *commandRegExp = [[NSRegularExpression alloc] initWithPattern:@"\\{[^\\}]+\\}" options:NSRegularExpressionCaseInsensitive error:0];
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
NSArray *autotypeEntries = [self.root autotypeableChildEntries];
|
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) {
|
for(KPKEntry *entry in autotypeEntries) {
|
||||||
/* Test for title */
|
/* Test for title */
|
||||||
NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];
|
NSRange titleRange = [entry.title rangeOfString:windowTitle options:NSCaseInsensitiveSearch];
|
||||||
|
|||||||
Reference in New Issue
Block a user