Permalink
Browse files

CocoaWrapper: fix attempt to mutate an immutable dictionary

  • Loading branch information...
1 parent 88bbd16 commit ae053a6f82d8f8992a1fee20f12f046e34e1bb38 @bradallred bradallred committed Nov 30, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 apple/CocoaWrapper/mac/CocoaWrapper.mm
@@ -104,7 +104,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *) __unused aNotification
[defaults setValue:cachePath forKey:@"CachePath"];
}
- NSMutableDictionary* additionalPaths = [defaults valueForKey:@"AdditionalPaths"];
+ NSMutableDictionary* additionalPaths = [[defaults dictionaryForKey:@"AdditionalPaths"] mutableCopy];
if ([additionalPaths valueForKey:@"CustomFontPath"] == nil) {
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, NO);
NSString* fontPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Fonts"];
@@ -113,6 +113,8 @@ - (void)applicationWillFinishLaunching:(NSNotification *) __unused aNotification
if ([additionalPaths valueForKey:@"SavePath"] == nil) {
[additionalPaths setValue:[defaults valueForKey:@"GamePath"] forKey:@"SavePath"];
}
+ [defaults setObject:additionalPaths forKey:@"AdditionalPaths"];
+ [additionalPaths release];
}
/* Called when the internal event loop has just started running */

0 comments on commit ae053a6

Please sign in to comment.