Fix template replacement cache update crash in RemoveAllGroupsForCompany

This commit is contained in:
Jonathan G Rennison
2023-04-03 20:59:47 +01:00
parent e3e743ba1e
commit d82a050365
3 changed files with 41 additions and 0 deletions

View File

@@ -1050,6 +1050,8 @@ Money GetGroupProfitLastYearMinAge(CompanyID company, GroupID id_g, VehicleType
void RemoveAllGroupsForCompany(const CompanyID company)
{
ReindexTemplateReplacementsRecursiveGuard guard;
for (Group *g : Group::Iterate()) {
if (company == g->owner) {
DeleteTemplateReplacementsByGroupID(g);