From 7bf5514e90de0673c0750101c36c358100ba6095 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Mon, 10 Apr 2023 20:53:18 +0300 Subject: [PATCH] Fix crashes in Clear Sky after e3868c21302b1c38806f26767b2a9cb7cb997fbd (#382, #392) --- src/xrGame/alife_anomalous_zone.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xrGame/alife_anomalous_zone.cpp b/src/xrGame/alife_anomalous_zone.cpp index 880f00eee79..911191ffa5a 100644 --- a/src/xrGame/alife_anomalous_zone.cpp +++ b/src/xrGame/alife_anomalous_zone.cpp @@ -77,10 +77,19 @@ void CSE_ALifeAnomalousZone::spawn_artefacts() typedef buffer_vector Weights; Weights weights(xr_alloca(n * sizeof(Weight)), n); + u32 missing_artefacts = 0; for (u32 i = 0; i < n; ++i) { string256 temp0, temp1; _GetItem(artefacts, 2 * i + 0, temp0); + if (!pSettings->section_exist(temp0)) + { +#ifndef MASTER_GOLD + Msg("! [%s] wants to spawn artefact [%s] with missing INI section.", name(), temp0); +#endif + ++missing_artefacts; + continue; + } _GetItem(artefacts, 2 * i + 1, temp1); weights.push_back( std::make_pair( @@ -89,6 +98,7 @@ void CSE_ALifeAnomalousZone::spawn_artefacts() ) ); } + n -= missing_artefacts; for (u32 i = 0; i < artefact_count; ++i) {