Catch all exceptions thrown by std::stoi()

This commit is contained in:
Raphael Coeffic
2022-01-01 13:51:20 +01:00
parent eb1e3078c8
commit 85a184f15e
5 changed files with 35 additions and 23 deletions
@@ -50,10 +50,12 @@ const YamlLookupTable sliderConfigLut = {
int YamlStickLookup::name2idx(const std::string& name)
{
int idx = std::stoi(name);
if (idx < 4) {
return idx;
}
try {
int idx = std::stoi(name);
if (idx < 4) {
return idx;
}
} catch(...) {}
return -1;
}