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 to specialists output
cache, to the waste cache.
  • Loading branch information
blabber authored and Tobias Rehbein committed Aug 30, 2024
1 parent 2a1f645 commit 0daf5f5
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 @@ -2878,7 +2878,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 0daf5f5

Please sign in to comment.