Skip to content

Commit

Permalink
Handle empty waste cache gracefully
Browse files Browse the repository at this point in the history
Apply the same defensive measure, we applied in 1eecc52 to specialists
output cache, to the waste cache.
  • Loading branch information
blabber committed Aug 1, 2024
1 parent 1eecc52 commit 225b4ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/city.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,8 @@ void set_city_production(struct city *pcity,
{
pcity->waste[o] =
city_waste(pcity, o, pcity->prod[o] * pcity->bonus[o] / 100, nullptr,
gov_centers, pcwaste ? &pcwaste->at(o) : nullptr);
gov_centers,
pcwaste && !pcwaste->empty() ? &pcwaste->at(o) : nullptr);
}
output_type_iterate_end;

Expand Down

0 comments on commit 225b4ce

Please sign in to comment.