Merge pull request #11526 from AdmiralCurtiss/netplay-crash

ENetUtil: Add check for valid socket in SendPacket().
This commit is contained in:
Admiral H. Curtiss 2023-02-10 21:24:04 +01:00 committed by GitHub
commit fbb3db71b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)