null reference to rtpconnection when end card is reached

Daniel Gultsch created

this will make re-init work if for example retry end card had been reached and we get another call

Change summary

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 7 +-
1 file changed, 4 insertions(+), 3 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java 🔗

@@ -766,8 +766,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
             if (state == RtpEndUserState.ENDED) {
                 finish();
                 return;
-            } else if (END_CARD.contains(state)) {
-                resetIntent(account, with, state, requireRtpConnection().getMedia());
             }
             runOnUiThread(() -> {
                 updateStateDisplay(state);
@@ -775,9 +773,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
                 updateVideoViews(state);
                 updateProfilePicture(state);
             });
+            if (END_CARD.contains(state)) {
+                resetIntent(account, with, state, requireRtpConnection().getMedia());
+                this.rtpConnectionReference = null;
+            }
         } else {
             Log.d(Config.LOGTAG, "received update for other rtp session");
-            //TODO if we only ever have one; we might just switch over? Maybe!
         }
     }