summaryrefslogtreecommitdiffstats
path: root/modules/enet/enet_connection.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-10-09 23:27:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-10-09 23:27:17 +0200
commit6b727ebdd298bdfad8b5c5ea78100bfb6a537d79 (patch)
tree494ae9cb69afcbdfc357850f2e75bea1a8f46ffa /modules/enet/enet_connection.cpp
parent62e7e1618ec63d8021456ef1f2a30c21dfc91202 (diff)
parent2eef0ffb777747498495610be770f15cdf130727 (diff)
downloadredot-engine-6b727ebdd298bdfad8b5c5ea78100bfb6a537d79.tar.gz
Merge pull request #83068 from AThousandShips/null_fix
Fix incorrect null check
Diffstat (limited to 'modules/enet/enet_connection.cpp')
-rw-r--r--modules/enet/enet_connection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp
index 1c4f51c665..2ccfd5d326 100644
--- a/modules/enet/enet_connection.cpp
+++ b/modules/enet/enet_connection.cpp
@@ -252,7 +252,7 @@ int ENetConnection::get_max_channels() const {
int ENetConnection::get_local_port() const {
ERR_FAIL_NULL_V_MSG(host, 0, "The ENetConnection instance isn't currently active.");
- ERR_FAIL_NULL_V_MSG(host->socket, 0, "The ENetConnection instance isn't currently bound.");
+ ERR_FAIL_COND_V_MSG(!(host->socket), 0, "The ENetConnection instance isn't currently bound.");
ENetAddress address;
ERR_FAIL_COND_V_MSG(enet_socket_get_address(host->socket, &address), 0, "Unable to get socket address");
return address.port;
@@ -344,7 +344,7 @@ void ENetConnection::_broadcast(int p_channel, PackedByteArray p_packet, int p_f
void ENetConnection::socket_send(const String &p_address, int p_port, const PackedByteArray &p_packet) {
ERR_FAIL_NULL_MSG(host, "The ENetConnection instance isn't currently active.");
- ERR_FAIL_NULL_MSG(host->socket, "The ENetConnection instance isn't currently bound.");
+ ERR_FAIL_COND_MSG(!(host->socket), "The ENetConnection instance isn't currently bound.");
ERR_FAIL_COND_MSG(p_port < 1 || p_port > 65535, "The remote port number must be between 1 and 65535 (inclusive).");
IPAddress ip;