If the user opens the OpenAFS preference pane and choose the Mounts
tab, the preference pane crashes.
To fix the problem, do not assume that we can cast a NSdictionary
object to NSMutableDictionary.
Change-Id: I3b5f6cb324a6b53c6b53606f71185f61450ee793
Reviewed-on: https://gerrit.openafs.org/12446
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
//get link configuration
NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
- mutabilityOption:NSPropertyListMutableContainers
- format:nil
- errorDescription:nil];
+ NSDictionary *linkDict = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+ mutabilityOption:NSPropertyListMutableContainers
+ format:nil
+ errorDescription:nil];
+ linkConfiguration = [linkDict mutableCopy];
//get link enabled status
NSNumber *linkEnabledStatus = (NSNumber*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_USE_LINK, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
//link configuration
NSData *prefData = (NSData*)CFPreferencesCopyValue((CFStringRef)PREFERENCE_LINK_CONFIGURATION, (CFStringRef)kAfsCommanderID, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
- linkConfiguration = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
- mutabilityOption:NSPropertyListMutableContainers
- format:nil
- errorDescription:nil];
+ NSDictionary *linkDict = (NSMutableDictionary*)[NSPropertyListSerialization propertyListFromData:prefData
+ mutabilityOption:NSPropertyListMutableContainers
+ format:nil
+ errorDescription:nil];
+ linkConfiguration = [linkDict mutableCopy];
}
// -------------------------------------------------------------------------------