From 8aea1d413c96dca96b7c5aa5d942203543c51ef9 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 26 May 2021 20:02:36 +1000 Subject: [PATCH] Fix crash if server sends multiple LevelInit packets with differing map volumes (Thanks minoclub + venksociety) --- src/Protocol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Protocol.c b/src/Protocol.c index fdd5dd878..4eca23a09 100644 --- a/src/Protocol.c +++ b/src/Protocol.c @@ -468,7 +468,10 @@ static void Classic_StartLoading(void) { } static void Classic_LevelInit(cc_uint8* data) { - if (!map_begunLoading) Classic_StartLoading(); + /* in case server is buggy and sends LevelInit multiple times */ + if (map_begunLoading) return; + + Classic_StartLoading(); if (!cpe_fastMap) return; /* Fast map puts volume in header, and uses raw DEFLATE without GZIP header/footer */