util.jid: Return early in join on invalid jids
authorKim Alvefur <zash@zash.se>
Thu, 7 Aug 2014 15:20:51 +0000 (17:20 +0200)
committerKim Alvefur <zash@zash.se>
Thu, 7 Aug 2014 15:20:51 +0000 (17:20 +0200)
util/jid.lua

index 08e633359e6afafeeb8d8144d1df8c991ed265a2..5db3d1f0d01b7acd6b2a048746a447f90ea93f12 100644 (file)
@@ -79,16 +79,15 @@ function prep(jid)
 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)