[Tasks] Crash fix with data input sanitization (#2629)

This commit is contained in:
Chris Miles 2022-12-10 17:31:18 -06:00 committed by GitHub
parent 1d06a4117a
commit 3dfeda9cea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -192,7 +192,7 @@ std::string Strings::Escape(const std::string &s)
bool Strings::IsNumber(const std::string &s)
{
try {
auto r = stod(s);
auto r = stoi(s);
return true;
}
catch (std::exception &) {

View File

@ -232,7 +232,9 @@ bool TaskManager::LoadTasks(int single_task)
);
for (auto &&e : zones) {
ad->zone_ids.push_back(std::stoi(e));
if (Strings::IsNumber(e)) {
ad->zone_ids.push_back(std::stoi(e));
}
}
ad->optional = a.optional;