Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -83,13 +83,18 @@ } - set: (OFObject*)key to: (OFObject*)obj { - uint32_t hash = [key hash] & (size - 1); + uint32_t hash; of_list_object_t *iter; + if (key == nil || obj == nil) + @throw [OFInvalidArgumentException newWithClass: isa]; + + hash = [key hash] & (size - 1); + if (data[hash] == nil) data[hash] = [OFList new]; for (iter = [data[hash] first]; iter != NULL; iter = iter->next->next) { if ([iter->object isEqual: key]) { @@ -107,13 +112,18 @@ return self; } - get: (OFObject*)key { - uint32_t hash = [key hash] & (size - 1); + uint32_t hash; of_list_object_t *iter; + if (key == nil) + @throw [OFInvalidArgumentException newWithClass: isa]; + + hash = [key hash] & (size - 1); + if (data[hash] == nil) @throw [OFNotInSetException newWithClass: isa]; for (iter = [data[hash] first]; iter != NULL; iter = iter->next->next) if ([iter->object isEqual: key]) @@ -122,13 +132,18 @@ @throw [OFNotInSetException newWithClass: isa]; } - remove: (OFObject*)key { - uint32_t hash = [key hash] & (size - 1); + uint32_t hash; of_list_object_t *iter; + if (key == nil) + @throw [OFInvalidArgumentException newWithClass: isa]; + + hash = [key hash] & (size - 1); + if (data[hash] == nil) @throw [OFNotInSetException newWithClass: isa]; for (iter = [data[hash] first]; iter != NULL; iter = iter->next->next) { if ([iter->object isEqual: key]) {