add check for invalid defensive item type
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -2393,9 +2393,11 @@ Action a_convert_item_parameter_table(
|
||||
auto data = std::make_shared<string>(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<bool>("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<bool>("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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user