From 706c231691376388a29d7082d80e52320fe946aa Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 11 Jul 2013 22:41:56 +0000 Subject: [PATCH] Avoid crash in case of ENENT_..._NONE messages (which typically don't have packet data). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13189 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/network/event.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/event.cpp b/src/network/event.cpp index 6334323a3..7072a6202 100644 --- a/src/network/event.cpp +++ b/src/network/event.cpp @@ -37,7 +37,10 @@ Event::Event(ENetEvent* event) type = EVENT_TYPE_MESSAGE; break; case ENET_EVENT_TYPE_NONE: - enet_packet_destroy(event->packet); + // Typically there's no packet data, but just in + // case test and delete it + if(event->packet) + enet_packet_destroy(event->packet); return; break; }