git » sdk » commit 600064d

If no attributes provided, set to empty not null

author Stephen Paul Weber
2023-12-11 15:58:47 UTC
committer Stephen Paul Weber
2023-12-11 18:38:29 UTC
parent 4b0758a5cc13079dea00ad865d90123963af14fd

If no attributes provided, set to empty not null

xmpp/Stanza.hx +2 -2

diff --git a/xmpp/Stanza.hx b/xmpp/Stanza.hx
index 2d189aa..a3efb96 100644
--- a/xmpp/Stanza.hx
+++ b/xmpp/Stanza.hx
@@ -37,7 +37,7 @@ class TextNode implements NodeInterface {
 @:expose
 class Stanza implements NodeInterface {
 	public var name(default, null):String = null;
-	public var attr(default, null):DynamicAccess<String> = null;
+	public var attr(default, null):DynamicAccess<String> = {};
 	public var children(default, null):Array<Node> = [];
 	private var last_added(null, null):Stanza;
 	private var last_added_stack(null, null):Array<Stanza> = [];
@@ -115,7 +115,7 @@ class Stanza implements NodeInterface {
 	}
 
 	public function textTag(tagName:String, textContent:String, ?attr:DynamicAccess<String>) {
-		this.last_added.addDirectChild(Element(new Stanza(tagName, attr).text(textContent)));
+		this.last_added.addDirectChild(Element(new Stanza(tagName, attr ?? {}).text(textContent)));
 		return this;
 	}