From e545e95d397d02fdd4233cb0da5ea7084cdf45c9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 16 Apr 2020 19:49:34 +0200 Subject: [PATCH] getMedia() would throw null pointer when called after going from proposed to some error state --- build.gradle | 4 ++-- .../eu/siacs/conversations/ui/RtpSessionActivity.java | 1 - .../conversations/xmpp/jingle/JingleRtpConnection.java | 9 +++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 606021a97..f19f8e28a 100644 --- a/build.gradle +++ b/build.gradle @@ -92,8 +92,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 369 - versionName "2.8.0-alpha.3" + versionCode 370 + versionName "2.8.0-alpha.4" archivesBaseName += "-$versionName" applicationId "eu.siacs.conversations" resValue "string", "applicationId", applicationId diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index cff788e04..b1beee945 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -659,7 +659,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe final AbstractJingleConnection.Id id = requireRtpConnection().getId(); if (account == id.account && id.with.equals(with) && id.sessionId.equals(sessionId)) { if (state == RtpEndUserState.ENDED) { - resetIntent(account, with, state, requireRtpConnection().getMedia()); finish(); return; } else if (END_CARD.contains(state)) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index f2a877d04..5f0ccb43c 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -756,9 +756,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web throw new IllegalStateException("RTP connection has not been initialized yet"); } if (isInState(State.PROPOSED, State.PROCEED)) { - return Preconditions.checkNotNull(this.proposedMedia, "RTP connection has not been initialized properly"); + return Preconditions.checkNotNull(this.proposedMedia, "RTP connection has not been initialized properly"); + } + final RtpContentMap initiatorContentMap = initiatorRtpContentMap; + if (initiatorContentMap != null) { + return initiatorContentMap.getMedia(); + } else { + return Preconditions.checkNotNull(this.proposedMedia, "RTP connection has not been initialized properly"); } - return Preconditions.checkNotNull(initiatorRtpContentMap.getMedia()); }