client.lua

changeset 364
69fc23b44819
parent 344
ea668c47e1bd
child 400
0db9cb909cf1
--- a/client.lua	Tue Sep 30 12:16:33 2014 +0200
+++ b/client.lua	Tue Sep 30 12:18:28 2014 +0200
@@ -53,9 +53,13 @@
 
 function stream_callbacks.error(stream, e, stanza)
 	if stream:event(e, stanza) == nil then
-		local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams");
-		local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams");
-		error(err.name..(text and ": "..text or ""));
+		if stanza then
+			local err = stanza:get_child(nil, "urn:ietf:params:xml:ns:xmpp-streams");
+			local text = stanza:get_child_text("text", "urn:ietf:params:xml:ns:xmpp-streams");
+			error(err.name..(text and ": "..text or ""));
+		else
+			error(stanza and stanza.name or e or "unknown-error");
+		end
 	end
 end
 

mercurial