From bcd3893e7d57956df05235260a82873766b0631f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 6 Dec 2024 04:14:58 +0100 Subject: [PATCH] Rewrite method to return early MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- .../talk/webrtc/PeerConnectionWrapper.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java index 08c6b8fcf..9474471fe 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java @@ -286,13 +286,15 @@ public class PeerConnectionWrapper { */ public void send(DataChannelMessage dataChannelMessage) { DataChannel statusDataChannel = dataChannels.get("status"); - if (statusDataChannel != null && dataChannelMessage != null) { - try { - ByteBuffer buffer = ByteBuffer.wrap(LoganSquare.serialize(dataChannelMessage).getBytes()); - statusDataChannel.send(new DataChannel.Buffer(buffer, false)); - } catch (Exception e) { - Log.d(TAG, "Failed to send channel data, attempting regular " + dataChannelMessage); - } + if (statusDataChannel == null || dataChannelMessage == null) { + return; + } + + try { + ByteBuffer buffer = ByteBuffer.wrap(LoganSquare.serialize(dataChannelMessage).getBytes()); + statusDataChannel.send(new DataChannel.Buffer(buffer, false)); + } catch (Exception e) { + Log.d(TAG, "Failed to send channel data, attempting regular " + dataChannelMessage); } }