Presence packet parse bugfix.

tong [09-12-20 17:35]
Presence packet parse bugfix.
Filename
xmpp/Presence.hx
diff --git a/xmpp/Presence.hx b/xmpp/Presence.hx
index e529a1e..4e725c7 100644
--- a/xmpp/Presence.hx
+++ b/xmpp/Presence.hx
@@ -62,15 +62,13 @@ class Presence extends Packet {
 		if( x.exists( "type" ) )
 			p.type = Type.createEnum( PresenceType, x.get( "type" ) );
 		for( c in x.elements() ) {
-			var _c = c.firstChild();
-			//if( _c != null ) { //TODO !
-				switch( c.nodeName ) {
-				case "show" : p.show = Type.createEnum( PresenceShow, _c.nodeValue );
-				case "status" : p.status =  _c.nodeValue;
-				case "priority" : p.priority = Std.parseInt( _c.nodeValue );
-				default : p.properties.push( c );
-				}
-			//}
+			var fc = c.firstChild();
+			switch( c.nodeName ) {
+			case "show" : if( fc != null ) p.show = Type.createEnum( PresenceShow, fc.nodeValue );
+			case "status" : if( fc != null ) p.status =  fc.nodeValue;
+			case "priority" : if( fc != null ) p.priority = Std.parseInt( fc.nodeValue );
+			default : p.properties.push( c );
+			}
 		}
 		return p;
 	}
ViewGit