MacOS-X compatibility fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20274 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-10-31 10:08:20 +00:00
parent b65f2e35c7
commit c8aae944a4
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2004-10-31 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: ([setObject:forKey:]) when given a nil
value to set, remove any existing object for the key. Fix for
MacOS-X compatibility (bug #10743).
2004-10-29 Matt Rice <ratmice@yahoo.com>
* Source/Additions/GSObjCRuntime.m (GSObjCAllSubclassesOfClass,

View file

@ -1194,23 +1194,23 @@ static BOOL isPlistObject(id o)
* if this is the first change to a persistent-domain since the
* last -synchronize.
* </p>
* If value is nil, this is equivalent to the -removeObjectForKey: method.
*/
- (void) setObject: (id)value forKey: (NSString*)defaultName
{
NSMutableDictionary *dict;
id obj;
if (value == nil)
{
[self removeObjectForKey: defaultName];
}
if ([defaultName isKindOfClass: [NSString class]] == NO
|| [defaultName length] == 0)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to set object with bad key (%@)", defaultName];
}
if (value == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to set nil object for key (%@)", defaultName];
}
if (isPlistObject(value) == NO)
{
[NSException raise: NSInvalidArgumentException