From 2f6e7d497dda1373d2a18297ad42973781f7fc11 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Wed, 1 Feb 2023 08:55:05 +0100 Subject: [PATCH] ENetUtil: Add check for valid socket in SendPacket(). --- Source/Core/Common/ENetUtil.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Common/ENetUtil.cpp b/Source/Core/Common/ENetUtil.cpp index d06de7c82a..3cdfbf8829 100644 --- a/Source/Core/Common/ENetUtil.cpp +++ b/Source/Core/Common/ENetUtil.cpp @@ -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)