From 125f9930674f6d11ddb50b2c1b4c2cad821dc01f Mon Sep 17 00:00:00 2001 From: nowinar Date: Sat, 2 Nov 2024 22:20:02 +0100 Subject: [PATCH] Fixing crash in which when you lowered the render distance game would crash. --- ScuffedMinecraft/src/Planet.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ScuffedMinecraft/src/Planet.cpp b/ScuffedMinecraft/src/Planet.cpp index 1e40bd4..3ee01e5 100644 --- a/ScuffedMinecraft/src/Planet.cpp +++ b/ScuffedMinecraft/src/Planet.cpp @@ -103,9 +103,11 @@ void Planet::ChunkThreadUpdate() chunks.find({ pos.x, pos.y, pos.z - 1 }) == chunks.end()) { delete chunkData.at(pos); - chunkData.erase(pos); + it = chunkData.erase(it); + } + else { + ++it; } - ++it; } // Check if camera moved to new chunk