Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(prosody): Adds some nil checks.

damencho2245e4e747ab
diff --git a/resources/prosody-plugins/mod_polls_component.lua b/resources/prosody-plugins/mod_polls_component.lua
index 3d2a43bdd3..514ad06ff4 100644
--- a/resources/prosody-plugins/mod_polls_component.lua
+++ b/resources/prosody-plugins/mod_polls_component.lua
@@ -141,6 +141,11 @@ end
local main_room = get_room_by_name_and_subdomain(session.jitsi_web_query_room, session.jitsi_web_query_prefix);
local occupant_jid = stanza.attr.from;
+ if not main_room then
+ module:log('warn', 'No main room found for %s %s', session.jitsi_web_query_room, session.jitsi_web_query_prefix);
+ return;
+ end
+
occupant = main_room:get_occupant_by_real_jid(occupant_jid);
if main_room._data.breakout_rooms_active and not occupant then
@@ -148,10 +153,13 @@ end
-- not in main room, let's check breakout rooms
for breakout_room_jid, subject in pairs(main_room._data.breakout_rooms or {}) do
local breakout_room = get_room_from_jid(breakout_room_jid);
- occupant = breakout_room:get_occupant_by_real_jid(occupant_jid);
- if occupant then
- room = breakout_room;
- break;
+
+ if breakout_room then
+ occupant = breakout_room:get_occupant_by_real_jid(occupant_jid);
+ if occupant then
+ room = breakout_room;
+ break;
+ end
end
end
else
diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.lua
index 88037ad827..4db0090d59 100644
--- a/resources/prosody-plugins/token/util.lib.lua
+++ b/resources/prosody-plugins/token/util.lib.lua
@@ -279,7 +279,9 @@ function Util:process_and_verify_token(session)
-- We're fetching an public key from an ASAP server
local dotFirst = session.auth_token:find("%.");
if not dotFirst then return false, "not-allowed", "Invalid token" end
- local header, err = json_safe.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)));
+ local headerPartEncoded = basexx.from_url64(session.auth_token:sub(1,dotFirst-1));
+ if not headerPartEncoded then return false, "not-allowed", "Invalid token" end
+ local header, err = json_safe.decode(headerPartEncoded);
if err then
return false, "not-allowed", "bad token format";
end