Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -167,10 +167,14 @@ stringValue: (OFString*)stringValue { self = [super init]; @try { + if (name_ == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + name = [name_ copy]; ns = [ns_ copy]; namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects: @@ -190,10 +194,14 @@ - initWithCharacters: (OFString*)characters_ { self = [super init]; @try { + if (characters_ == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + characters = [characters_ copy]; } @catch (id e) { [self release]; @throw e; } @@ -204,10 +212,14 @@ - initWithCDATA: (OFString*)CDATA_ { self = [super init]; @try { + if (CDATA_) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + CDATA = [CDATA_ copy]; } @catch (id e) { [self release]; @throw e; } @@ -218,10 +230,14 @@ - initWithComment: (OFString*)comment_ { self = [super init]; @try { + if (comment_ == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + comment = [comment_ copy]; } @catch (id e) { [self release]; @throw e; } @@ -232,10 +248,14 @@ - initWithElement: (OFXMLElement*)element { self = [super init]; @try { + if (element == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + name = [element->name copy]; ns = [element->ns copy]; defaultNamespace = [element->defaultNamespace copy]; attributes = [element->attributes mutableCopy]; namespaces = [element->namespaces mutableCopy]; @@ -260,10 +280,14 @@ Class c; c = isa; [self release]; + if (string == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + pool = [[OFAutoreleasePool alloc] init]; parser = [OFXMLParser parser]; builder = [OFXMLElementBuilder elementBuilder]; delegate = [[[OFXMLElement_OFXMLElementBuilderDelegate alloc] init]