Skip to content

Commit

Permalink
bounds check the choice data
Browse files Browse the repository at this point in the history
old forts that persisted data before this attribute existed will have an
invalid value
  • Loading branch information
myk002 committed Mar 29, 2023
1 parent 12e7ae1 commit 0db9376
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/buildingplan/defaultitemfilters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ DefaultItemFilters::DefaultItemFilters(color_ostream &out, BuildingTypeKey key,
DefaultItemFilters::DefaultItemFilters(color_ostream &out, PersistentDataItem &filter_config, const std::vector<const df::job_item *> &jitems)
: key(getKey(filter_config)), filter_config(filter_config) {
choose_items = get_config_val(filter_config, FILTER_CONFIG_CHOOSE_ITEMS);
if (choose_items < ItemSelectionChoice::ITEM_SELECTION_CHOICE_FILTER ||
choose_items > ItemSelectionChoice::ITEM_SELECTION_CHOICE_AUTOMATERIAL)
choose_items = ItemSelectionChoice::ITEM_SELECTION_CHOICE_FILTER;
auto &serialized = filter_config.val();
DEBUG(status,out).print("deserializing default item filters for key %d,%d,%d: %s\n",
std::get<0>(key), std::get<1>(key), std::get<2>(key), serialized.c_str());
Expand Down

0 comments on commit 0db9376

Please sign in to comment.