summaryrefslogtreecommitdiff
path: root/modules/webrtc/webrtc_data_channel_js.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webrtc/webrtc_data_channel_js.cpp')
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp6
1 files changed, 2 insertions, 4 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);