fix race condition when granting camera permission after request to switch to video

(cherry picked from commit 3f80a45997ad82dec9097a6556997a74f8a9ca01)
This commit is contained in:
Daniel Gultsch 2024-06-17 09:03:07 +02:00 committed by Arne
parent 0830669e9d
commit 0f449bd057

View file

@ -312,10 +312,15 @@ public class RtpSessionActivity extends XmppActivity
private void acceptContentAdd() {
try {
requireRtpConnection()
.acceptContentAdd(requireRtpConnection().getPendingContentAddition().summary);
final ContentAddition pendingContentAddition =
requireRtpConnection().getPendingContentAddition();
if (pendingContentAddition == null) {
Log.d(Config.LOGTAG, "content offer was gone after granting permission");
return;
}
requireRtpConnection().acceptContentAdd(pendingContentAddition.summary);
} catch (final IllegalStateException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
Toast.makeText(this, Strings.nullToEmpty(e.getMessage()), Toast.LENGTH_SHORT).show();
}
}