Handle nil as argument to XMPPStanza's setters

This commit is contained in:
Florian Zeitz 2011-03-24 18:57:07 +01:00
parent a972fe397e
commit 1f98e7b726

View file

@ -161,6 +161,8 @@
[old release]; [old release];
[self removeAttributeForName: @"from"]; [self removeAttributeForName: @"from"];
if (from_ != nil)
[self addAttributeWithName: @"from" [self addAttributeWithName: @"from"
stringValue: from_.fullJID]; stringValue: from_.fullJID];
} }
@ -172,6 +174,8 @@
[old release]; [old release];
[self removeAttributeForName: @"to"]; [self removeAttributeForName: @"to"];
if (to_ != nil)
[self addAttributeWithName: @"to" [self addAttributeWithName: @"to"
stringValue: to_.fullJID]; stringValue: to_.fullJID];
} }
@ -183,6 +187,8 @@
[old release]; [old release];
[self removeAttributeForName: @"type"]; [self removeAttributeForName: @"type"];
if (type_ != nil)
[self addAttributeWithName: @"type" [self addAttributeWithName: @"type"
stringValue: type]; stringValue: type];
} }
@ -194,6 +200,8 @@
[old release]; [old release];
[self removeAttributeForName: @"id"]; [self removeAttributeForName: @"id"];
if (ID_ != nil)
[self addAttributeWithName: @"id" [self addAttributeWithName: @"id"
stringValue: ID]; stringValue: ID];
} }