Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -147,10 +147,14 @@ self = [super init]; @try { uint32_t i; struct of_dictionary_bucket *bucket; + + if (key == nil || object == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; data = [self allocMemoryForNItems: 2 withSize: sizeof(*bucket)]; size = 2; @@ -710,21 +714,23 @@ - (OFString*)description { OFMutableString *ret = [OFMutableString stringWithString: @"{\n"]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2; - OFEnumerator *enumerator = [self keyEnumerator]; - id key; + OFEnumerator *keyEnumerator = [self keyEnumerator]; + OFEnumerator *objectEnumerator = [self objectEnumerator]; + id key, object; size_t i; i = 0; pool2 = [[OFAutoreleasePool alloc] init]; - while ((key = [enumerator nextObject]) != nil) { + while ((key = [keyEnumerator nextObject]) != nil && + (object = [objectEnumerator nextObject]) != nil) { [ret appendString: [key description]]; [ret appendString: @" = "]; - [ret appendString: [[self objectForKey: key] description]]; + [ret appendString: [object description]]; if (++i < count) [ret appendString: @";\n"]; [pool2 releaseObjects];