diff --git a/modules/terrain/terrain.cpp b/modules/terrain/terrain.cpp index 5ef9f828..a0d96d56 100644 --- a/modules/terrain/terrain.cpp +++ b/modules/terrain/terrain.cpp @@ -75,7 +75,9 @@ void Terrain::_notification(int what) { this->threads_stop = true; this->workload_lock.unlock(); for (Thread &thread : this->threads) { - thread.wait_to_finish(); + if (thread.is_started()) { + thread.wait_to_finish(); + } } return; } @@ -115,7 +117,9 @@ void Terrain::construct_chunk_grid() { this->threads_stop = true; this->workload_lock.unlock(); for (Thread &thread : this->threads) { - thread.wait_to_finish(); + if (thread.is_started()) { + thread.wait_to_finish(); + } } this->workload_lock.lock(); for (TerrainChunkMesh *mesh : this->meshes) {