diff --git a/src/ItemParameterTable.cc b/src/ItemParameterTable.cc index 6bcad298..fcfebd02 100644 --- a/src/ItemParameterTable.cc +++ b/src/ItemParameterTable.cc @@ -940,10 +940,11 @@ public: case 3: return this->unit_sale_divisor; } + throw runtime_error("invalid defensive item type"); case 2: return this->mag_sale_divisor; default: - throw logic_error("item type does not have a sale divisor"); + throw runtime_error("item type does not have a sale divisor"); } } diff --git a/src/Main.cc b/src/Main.cc index df2c8560..644c4fd8 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -2393,9 +2393,11 @@ Action a_convert_item_parameter_table( auto data = std::make_shared(read_input_data(args)); auto pmt = ItemParameterTable::from_binary(data, get_cli_version(args, Version::BB_V4)); auto json = pmt->json(); - uint32_t hex_option = args.get("hex") ? phosg::JSON::SerializeOption::HEX_INTEGERS : 0; - string json_data = json.serialize( - phosg::JSON::SerializeOption::FORMAT | hex_option | phosg::JSON::SerializeOption::SORT_DICT_KEYS); + uint32_t serialize_options = phosg::JSON::SerializeOption::FORMAT | phosg::JSON::SerializeOption::SORT_DICT_KEYS; + if (args.get("hex")) { + serialize_options |= phosg::JSON::SerializeOption::HEX_INTEGERS; + } + string json_data = json.serialize(serialize_options); write_output_data(args, json_data.data(), json_data.size(), nullptr); });