getMedia() would throw null pointer when called after going from proposed to some error state

This commit is contained in:
Daniel Gultsch 2020-04-16 19:49:34 +02:00
parent ea2ed85ed7
commit e545e95d39
3 changed files with 9 additions and 5 deletions

View file

@ -92,8 +92,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode 369 versionCode 370
versionName "2.8.0-alpha.3" versionName "2.8.0-alpha.4"
archivesBaseName += "-$versionName" archivesBaseName += "-$versionName"
applicationId "eu.siacs.conversations" applicationId "eu.siacs.conversations"
resValue "string", "applicationId", applicationId resValue "string", "applicationId", applicationId

View file

@ -659,7 +659,6 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
final AbstractJingleConnection.Id id = requireRtpConnection().getId(); final AbstractJingleConnection.Id id = requireRtpConnection().getId();
if (account == id.account && id.with.equals(with) && id.sessionId.equals(sessionId)) { if (account == id.account && id.with.equals(with) && id.sessionId.equals(sessionId)) {
if (state == RtpEndUserState.ENDED) { if (state == RtpEndUserState.ENDED) {
resetIntent(account, with, state, requireRtpConnection().getMedia());
finish(); finish();
return; return;
} else if (END_CARD.contains(state)) { } else if (END_CARD.contains(state)) {

View file

@ -756,9 +756,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
throw new IllegalStateException("RTP connection has not been initialized yet"); throw new IllegalStateException("RTP connection has not been initialized yet");
} }
if (isInState(State.PROPOSED, State.PROCEED)) { 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());
} }