EvanatorM / ScuffedMinecraft

A Minecraft Clone in C++
MIT License
142 stars 23 forks source link

Fixing crash when changing render distance #21

Open nowinar opened 3 weeks ago

nowinar commented 3 weeks ago

This fixes a bug in Planet.cpp which caused crash when lowering the render distance. As of my observations, it is fixed by this commit. It was caused by deleting from a map which we were iterating through. The crash is shown in this screenshot: image And this is the call stack:

ScuffedMinecraft.exe!std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<ChunkPos const ,ChunkData >>>>::operator++() Line 160 C++ ScuffedMinecraft.exe!std::_List_iterator<std::_List_val<std::_List_simple_types<std::pair<ChunkPos const ,ChunkData >>>>::operator++() Line 246 C++ ScuffedMinecraft.exe!Planet::ChunkThreadUpdate() Line 108 C++

fintmc commented 3 weeks ago

LGTM