mirror of https://github.com/OpenTTD/OpenTTD
Codefix: std::string_view does not accept nullptr
parent
dc956a758d
commit
a0e0795e9e
|
@ -273,7 +273,7 @@ static void ExtractStringParams(const StringData &data, StringParamsList ¶ms
|
||||||
if (*it == nullptr) {
|
if (*it == nullptr) {
|
||||||
/* Skip empty param unless a non empty param exist after it. */
|
/* Skip empty param unless a non empty param exist after it. */
|
||||||
if (std::all_of(it, pcs.consuming_commands.end(), [](auto cs) { return cs == nullptr; })) break;
|
if (std::all_of(it, pcs.consuming_commands.end(), [](auto cs) { return cs == nullptr; })) break;
|
||||||
param.emplace_back(StringParam::UNUSED, 1, nullptr);
|
param.emplace_back(StringParam::UNUSED, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const CmdStruct *cs = *it;
|
const CmdStruct *cs = *it;
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct StringParam {
|
||||||
uint8_t consumes;
|
uint8_t consumes;
|
||||||
std::string_view cmd;
|
std::string_view cmd;
|
||||||
|
|
||||||
StringParam(ParamType type, uint8_t consumes, std::string_view cmd) : type(type), consumes(consumes), cmd(cmd) {}
|
StringParam(ParamType type, uint8_t consumes, std::string_view cmd = {}) : type(type), consumes(consumes), cmd(cmd) {}
|
||||||
};
|
};
|
||||||
using StringParams = std::vector<StringParam>;
|
using StringParams = std::vector<StringParam>;
|
||||||
using StringParamsList = std::vector<StringParams>;
|
using StringParamsList = std::vector<StringParams>;
|
||||||
|
|
Loading…
Reference in New Issue