ENetUtil: Add check for valid socket in SendPacket().

This commit is contained in:
Admiral H. Curtiss 2023-02-01 08:55:05 +01:00
parent 9b5c52ad8d
commit 2f6e7d497d
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,12 @@ int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event)
bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id)
{
if (!socket)
{
ERROR_LOG_FMT(NETPLAY, "Target socket is null.");
return false;
}
ENetPacket* epac =
enet_packet_create(packet.getData(), packet.getDataSize(), ENET_PACKET_FLAG_RELIABLE);
if (!epac)