Fix crash when setting participant layout before receiving the data

When setting the participant layout, if the HPB is not used, the user ID
is got from the participant list data fetched when a new participant is
found. However, as the participant layout is setup as soon as a new
participant is found the data may have not been received yet, which
ended in a crash (NullPointerException). Now the access to the
participant object is guarded to prevent that.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-10-10 01:48:58 +02:00 committed by Tim Krüger
parent 89607b8776
commit 4f01cb855a
No known key found for this signature in database
GPG key ID: FECE3A7222C52A4E

View file

@ -2361,7 +2361,7 @@ public class CallActivity extends CallBaseActivity {
String userId = "";
if (hasMCU) {
userId = webSocketClient.getUserIdForSession(session);
} else if (participantMap.get(session).getCalculatedActorType() == Participant.ActorType.USERS) {
} else if (participantMap.get(session) != null && participantMap.get(session).getCalculatedActorType() == Participant.ActorType.USERS) {
userId = participantMap.get(session).getCalculatedActorId();
}