Skip to content

Commit

Permalink
CallFrament: check if data channel is available before sending data.
Browse files Browse the repository at this point in the history
  • Loading branch information
aforge committed Feb 21, 2023
1 parent 8fc2670 commit 612b433
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/co/tinode/tindroid/CallFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,12 @@ private void handleSendAnswer(SessionDescription sd) {
}

private void sendToPeer(String msg) {
mDataChannel.send(new DataChannel.Buffer(
ByteBuffer.wrap(msg.getBytes(StandardCharsets.UTF_8)), false));
if (mDataChannel != null) {
mDataChannel.send(new DataChannel.Buffer(
ByteBuffer.wrap(msg.getBytes(StandardCharsets.UTF_8)), false));
} else {
Log.w(TAG, "Data channel is null. Peer will not receive the message: '" + msg + "'");
}
}

// Data channel observer for receiving video mute/unmute events.
Expand Down

0 comments on commit 612b433

Please sign in to comment.