Diff

util/jid.lua @ 6338:736c388748fd

util.jid: Return early in join on invalid jids
author Kim Alvefur <zash@zash.se>
date Thu, 07 Aug 2014 17:20:51 +0200
parent 5945:51ead0aa3a02
child 6339:1c19464cde77
line wrap: on
line diff
--- a/util/jid.lua	Fri Jul 25 21:12:21 2014 +0200
+++ b/util/jid.lua	Thu Aug 07 17:20:51 2014 +0200
@@ -79,16 +79,15 @@
 end
 
 function join(node, host, resource)
-	if node and host and resource then
+	if not host then return end -- Invalid JID
+	if node and resource then
 		return node.."@"..host.."/"..resource;
-	elseif node and host then
+	elseif node then
 		return node.."@"..host;
-	elseif host and resource then
+	elseif resource then
 		return host.."/"..resource;
-	elseif host then
-		return host;
 	end
-	return nil; -- Invalid JID
+	return host;
 end
 
 function compare(jid, acl)