avoid NPE in CallActivity#onDestroy

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:6032)
  at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:6077)
  at android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:47)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2443)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  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)
Caused by java.lang.NullPointerException:
  at com.nextcloud.talk.activities.CallActivity.onDestroy (CallActivity.java:1244)
  at android.app.Activity.performDestroy (Activity.java:8571)
  at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1364)
  at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:6019)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-02-08 13:25:55 +01:00
parent bbcf485dbc
commit dcc323f0a8
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -1318,7 +1318,9 @@ public class CallActivity extends CallBaseActivity {
@Override @Override
public void onDestroy() { public void onDestroy() {
signalingMessageReceiver.removeListener(offerMessageListener); if (signalingMessageReceiver != null) {
signalingMessageReceiver.removeListener(offerMessageListener);
}
if (localStream != null) { if (localStream != null) {
localStream.dispose(); localStream.dispose();