From aecd893ea004db2ae614c77d8f6672066b205ee9 Mon Sep 17 00:00:00 2001 From: MasterLaplace Date: Fri, 22 Nov 2024 23:32:29 -0500 Subject: [PATCH] feat: handle empty packets in UDPServer to prevent processing errors --- Flakkari/Server/UDPServer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flakkari/Server/UDPServer.cpp b/Flakkari/Server/UDPServer.cpp index e36e672b..46d94930 100644 --- a/Flakkari/Server/UDPServer.cpp +++ b/Flakkari/Server/UDPServer.cpp @@ -62,6 +62,8 @@ bool UDPServer::handleInput(int fd) void UDPServer::handlePacket() { auto packet = _socket->receiveFrom(); + if (!packet.has_value()) + return; auto resultAddClient = ClientManager::GetInstance().addClient(packet->first, packet->second); ClientManager::UnlockInstance(); if (!resultAddClient.has_value())