From 112a5662adeeb6f31ed6495f737c068c0a6ffb28 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 May 2021 11:47:09 +0200 Subject: [PATCH] Fix null reference when a participant leaves java.lang.NullPointerException: Attempt to invoke virtual method 'void com.nextcloud.talk.adapters.ParticipantDisplayItem.setAudioEnabled(boolean)' on a null object reference Signed-off-by: Joas Schilling --- .../nextcloud/talk/controllers/CallController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index 74abe1b4d..db683cc2e 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -1866,15 +1866,21 @@ public class CallController extends BaseController { } } } else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent.PeerConnectionEventType.NICK_CHANGE)) { - participantDisplayItems.get(sessionId).setNick(peerConnectionEvent.getNick()); + if (participantDisplayItems.get(sessionId) != null) { + participantDisplayItems.get(sessionId).setNick(peerConnectionEvent.getNick()); + } participantsAdapter.notifyDataSetChanged(); } else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent.PeerConnectionEventType.VIDEO_CHANGE) && !isVoiceOnlyCall) { - participantDisplayItems.get(sessionId).setStreamEnabled(peerConnectionEvent.getChangeValue()); + if (participantDisplayItems.get(sessionId) != null) { + participantDisplayItems.get(sessionId).setStreamEnabled(peerConnectionEvent.getChangeValue()); + } participantsAdapter.notifyDataSetChanged(); } else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent.PeerConnectionEventType.AUDIO_CHANGE)) { - participantDisplayItems.get(sessionId).setAudioEnabled(peerConnectionEvent.getChangeValue()); + if (participantDisplayItems.get(sessionId) != null) { + participantDisplayItems.get(sessionId).setAudioEnabled(peerConnectionEvent.getChangeValue()); + } participantsAdapter.notifyDataSetChanged(); } else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent.PeerConnectionEventType.PUBLISHER_FAILED)) {