avoid NPE on hangup

Exception java.lang.NullPointerException:
  at com.nextcloud.talk.activities.CallActivity.hangupNetworkCalls (CallActivity.java:1749)
  at com.nextcloud.talk.activities.CallActivity.hangup (CallActivity.java:1741)
  at com.nextcloud.talk.activities.CallActivity.lambda$initClickListeners$8$com-nextcloud-talk-activities-CallActivity (CallActivity.java:465)
  at com.nextcloud.talk.activities.CallActivity$$ExternalSyntheticLambda16.onClick
  at android.view.View.performClick (View.java:7792)
  at android.view.View.performClickInternal (View.java:7769)
  at android.view.View.access$3800 (View.java:910)
  at android.view.View$PerformClick.run (View.java:30218)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8751)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-01-19 13:08:05 +01:00 committed by Marcel Hibbe (Rebase PR Action)
parent 7b60780ec5
commit aec1f63da2

View file

@ -1746,8 +1746,10 @@ public class CallActivity extends CallBaseActivity {
Log.d(TAG, "hangupNetworkCalls. shutDownView=" + shutDownView);
int apiVersion = ApiUtils.getCallApiVersion(conversationUser, new int[]{ApiUtils.APIv4, 1});
callParticipantList.removeObserver(callParticipantListObserver);
callParticipantList.destroy();
if (callParticipantList != null) {
callParticipantList.removeObserver(callParticipantListObserver);
callParticipantList.destroy();
}
ncApi.leaveCall(credentials, ApiUtils.getUrlForCall(apiVersion, baseUrl, roomToken))
.subscribeOn(Schedulers.io())