From 8e4800885af11e5d92508ebf25996808f268cd7a Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 2 Aug 2025 15:50:43 -0500 Subject: [PATCH] bounds check when importing legacy journal entry --- src/universe/party.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/universe/party.cpp b/src/universe/party.cpp index deb94041..d8235d33 100644 --- a/src/universe/party.cpp +++ b/src/universe/party.cpp @@ -283,7 +283,10 @@ void cParty::import_legacy(legacy::setup_save_type& old){ } void cParty::cConvers::import_legacy(legacy::talk_save_type old, const cScenario& scenario){ - who_said = scenario.towns[old.personality / 10]->talking.people[old.personality % 10].title; + size_t town = old.personality / 10; + size_t npc = old.personality % 10; + if(town >= scenario.towns.size()) return; + who_said = scenario.towns[town]->talking.people[npc].title; in_town = scenario.towns[old.town_num]->name; int strnums[2] = {old.str1, old.str2}; std::string* strs[2] = {&the_str1, &the_str2};