summaryrefslogtreecommitdiff
path: root/modules/webrtc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webrtc')
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp6
-rw-r--r--modules/webrtc/webrtc_multiplayer.cpp6
-rw-r--r--modules/webrtc/webrtc_peer_connection_gdnative.cpp6
3 files changed, 6 insertions, 12 deletions
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp
index 069918cc9c..996db35cba 100644
--- a/modules/webrtc/webrtc_data_channel_js.cpp
+++ b/modules/webrtc/webrtc_data_channel_js.cpp
@@ -68,10 +68,8 @@ void WebRTCDataChannelJS::_on_error() {
}
void WebRTCDataChannelJS::_on_message(uint8_t *p_data, uint32_t p_size, bool p_is_string) {
- if (in_buffer.space_left() < (int)(p_size + 5)) {
- ERR_EXPLAIN("Buffer full! Dropping data");
- ERR_FAIL();
- }
+
+ ERR_FAIL_COND_MSG(in_buffer.space_left() < (int)(p_size + 5), "Buffer full! Dropping data.");
uint8_t is_string = p_is_string ? 1 : 0;
in_buffer.write((uint8_t *)&p_size, 4);
diff --git a/modules/webrtc/webrtc_multiplayer.cpp b/modules/webrtc/webrtc_multiplayer.cpp
index 17dafff93a..a759b17b83 100644
--- a/modules/webrtc/webrtc_multiplayer.cpp
+++ b/modules/webrtc/webrtc_multiplayer.cpp
@@ -321,10 +321,8 @@ Error WebRTCMultiplayer::put_packet(const uint8_t *p_buffer, int p_buffer_size)
if (target_peer > 0) {
E = peer_map.find(target_peer);
- if (!E) {
- ERR_EXPLAIN("Invalid Target Peer: " + itos(target_peer));
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
- }
+ ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer: " + itos(target_peer) + ".");
+
ERR_FAIL_COND_V(E->value()->channels.size() <= ch, ERR_BUG);
ERR_FAIL_COND_V(!E->value()->channels[ch].is_valid(), ERR_BUG);
return E->value()->channels[ch]->put_packet(p_buffer, p_buffer_size);
diff --git a/modules/webrtc/webrtc_peer_connection_gdnative.cpp b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
index af98aa750a..5e9dcb5366 100644
--- a/modules/webrtc/webrtc_peer_connection_gdnative.cpp
+++ b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
@@ -51,13 +51,11 @@ Error WebRTCPeerConnectionGDNative::set_default_library(const godot_net_webrtc_l
WebRTCPeerConnection *WebRTCPeerConnectionGDNative::_create() {
WebRTCPeerConnectionGDNative *obj = memnew(WebRTCPeerConnectionGDNative);
- ERR_EXPLAIN("Default GDNative WebRTC implementation not defined.");
- ERR_FAIL_COND_V(!default_library, obj);
+ ERR_FAIL_COND_V_MSG(!default_library, obj, "Default GDNative WebRTC implementation not defined.");
// Call GDNative constructor
Error err = (Error)default_library->create_peer_connection(obj);
- ERR_EXPLAIN("GDNative default library constructor returned an error");
- ERR_FAIL_COND_V(err != OK, obj);
+ ERR_FAIL_COND_V_MSG(err != OK, obj, "GDNative default library constructor returned an error.");
return obj;
}