Skip to content

Commit

Permalink
try to fix #1978
Browse files Browse the repository at this point in the history
i suspect that peerConnectionFactory could have been null because e.g. "hangup()" was already called which sets it to null. Because of some async task getOrCreatePeerConnectionWrapperForSessionIdAndType might still be called afterwards and it failed because peerConnectionFactory was already null.

Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi committed May 9, 2022
1 parent 4414002 commit a43a51b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
Expand Down Expand Up @@ -1885,6 +1886,14 @@ private PeerConnectionWrapper getOrCreatePeerConnectionWrapperForSessionIdAndTyp
if ((peerConnectionWrapper = getPeerConnectionWrapperForSessionIdAndType(sessionId, type)) != null) {
return peerConnectionWrapper;
} else {
if (peerConnectionFactory == null) {
Log.e(TAG, "peerConnectionFactory was null in getOrCreatePeerConnectionWrapperForSessionIdAndType.");
Toast.makeText(context, context.getResources().getString(R.string.nc_common_error_sorry),
Toast.LENGTH_LONG).show();
hangup(true);
return null;
}

if (hasMCU && publisher) {
peerConnectionWrapper = new PeerConnectionWrapper(peerConnectionFactory,
iceServers,
Expand Down

0 comments on commit a43a51b

Please sign in to comment.