Index: src/XMPPStanza.m ================================================================== --- src/XMPPStanza.m +++ src/XMPPStanza.m @@ -159,42 +159,50 @@ XMPPJID *old = from; from = [from_ copy]; [old release]; [self removeAttributeForName: @"from"]; - [self addAttributeWithName: @"from" - stringValue: from_.fullJID]; + + if (from_ != nil) + [self addAttributeWithName: @"from" + stringValue: from_.fullJID]; } - (void)setTo: (XMPPJID*)to_ { XMPPJID *old = to; to = [to_ copy]; [old release]; [self removeAttributeForName: @"to"]; - [self addAttributeWithName: @"to" - stringValue: to_.fullJID]; + + if (to_ != nil) + [self addAttributeWithName: @"to" + stringValue: to_.fullJID]; } - (void)setType: (OFString*)type_ { OFString *old = type; type = [type_ copy]; [old release]; [self removeAttributeForName: @"type"]; - [self addAttributeWithName: @"type" - stringValue: type]; + + if (type_ != nil) + [self addAttributeWithName: @"type" + stringValue: type]; } - (void)setID: (OFString*)ID_ { OFString* old = ID; ID = [ID_ copy]; [old release]; [self removeAttributeForName: @"id"]; - [self addAttributeWithName: @"id" - stringValue: ID]; + + if (ID_ != nil) + [self addAttributeWithName: @"id" + stringValue: ID]; } @end