Skip to content

Commit

Permalink
invalid_arg_is_numeric: handle also macOS
Browse files Browse the repository at this point in the history
std::invalid_argument::what() returns in macOS the string:
"stoi: no conversion"
  • Loading branch information
MartinPulec committed Sep 13, 2024
1 parent ef0cd71 commit 95ae4c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,5 @@ bool invalid_arg_is_numeric(const char *what) {
if (what == nullptr) {
return false;
}
return strcmp(what, "stoi") == 0 || strcmp(what, "stod") == 0;
return strncmp(what, "stoi", 4) == 0 || strncmp(what, "stod", 4) == 0;
}

0 comments on commit 95ae4c0

Please sign in to comment.