fix: prevent get_user_ids_from_room crash on missing session (#20271)

Add null check in list comprehension before accessing session['id']. When a session_id exists in the room but has been removed from SESSION_POOL, the function now skips it instead of crashing with TypeError.
This commit is contained in:
Classic298
2025-12-31 14:39:22 +01:00
committed by GitHub
parent 048692c068
commit f4670b3add

View File

@@ -246,7 +246,11 @@ def get_user_ids_from_room(room):
active_session_ids = get_session_ids_from_room(room)
active_user_ids = list(
set([SESSION_POOL.get(session_id)["id"] for session_id in active_session_ids])
set([
SESSION_POOL.get(session_id)["id"]
for session_id in active_session_ids
if SESSION_POOL.get(session_id) is not None
])
)
return active_user_ids