mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
Fix d1463f415f
: Wrong type of exception thrown by invalid string parameters.
`FormatString()` only catches `std::out_of_range`, but `GetNextParameter()` threw `std::runtime_error`.
This commit is contained in:
parent
3bfd9de68d
commit
719d063bd4
@ -94,7 +94,7 @@ public:
|
||||
const auto ¶m = GetNextParameterReference();
|
||||
const uint64_t *data = std::get_if<uint64_t>(¶m.data);
|
||||
if (data != nullptr) return static_cast<T>(*data);
|
||||
throw std::runtime_error("Attempt to read string parameter as integer");
|
||||
throw std::out_of_range("Attempt to read string parameter as integer");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public:
|
||||
const auto ¶m = GetNextParameterReference();
|
||||
const std::string *data = std::get_if<std::string>(¶m.data);
|
||||
if (data != nullptr) return data->c_str();
|
||||
throw std::runtime_error("Attempt to read integer parameter as string");
|
||||
throw std::out_of_range("Attempt to read integer parameter as string");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user