add check for invalid defensive item type
This commit is contained in:
@@ -940,10 +940,11 @@ public:
|
|||||||
case 3:
|
case 3:
|
||||||
return this->unit_sale_divisor;
|
return this->unit_sale_divisor;
|
||||||
}
|
}
|
||||||
|
throw runtime_error("invalid defensive item type");
|
||||||
case 2:
|
case 2:
|
||||||
return this->mag_sale_divisor;
|
return this->mag_sale_divisor;
|
||||||
default:
|
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 data = std::make_shared<string>(read_input_data(args));
|
||||||
auto pmt = ItemParameterTable::from_binary(data, get_cli_version(args, Version::BB_V4));
|
auto pmt = ItemParameterTable::from_binary(data, get_cli_version(args, Version::BB_V4));
|
||||||
auto json = pmt->json();
|
auto json = pmt->json();
|
||||||
uint32_t hex_option = args.get<bool>("hex") ? phosg::JSON::SerializeOption::HEX_INTEGERS : 0;
|
uint32_t serialize_options = phosg::JSON::SerializeOption::FORMAT | phosg::JSON::SerializeOption::SORT_DICT_KEYS;
|
||||||
string json_data = json.serialize(
|
if (args.get<bool>("hex")) {
|
||||||
phosg::JSON::SerializeOption::FORMAT | hex_option | phosg::JSON::SerializeOption::SORT_DICT_KEYS);
|
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);
|
write_output_data(args, json_data.data(), json_data.size(), nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user