Simple optimization in get_room_occupants_number command (#1964)

This commit is contained in:
Badlop 2017-09-07 18:32:26 +02:00
parent 4ecd8a0780
commit d87151aee6
1 changed files with 7 additions and 1 deletions

View File

@ -802,7 +802,13 @@ get_room_occupants(Pid) ->
dict:to_list(S#state.users)).
get_room_occupants_number(Room, Host) ->
length(get_room_occupants(Room, Host)).
case get_room_pid(Room, Host) of
room_not_found ->
throw({error, room_not_found});
Pid ->
S = get_room_state(Pid),
dict:size(S#state.users)
end.
%%----------------------------
%% Send Direct Invitation