diff --git a/lib/utils/math-helpers.cpp b/lib/utils/math-helpers.cpp index f7d5acd2..6da048f4 100644 --- a/lib/utils/math-helpers.cpp +++ b/lib/utils/math-helpers.cpp @@ -1,6 +1,7 @@ #include "math-helpers.hpp" #include "obs-module-helper.hpp" +#include #include #include @@ -41,7 +42,8 @@ std::optional GetDouble(const std::string &str) { char *end = nullptr; double value = std::strtod(str.c_str(), &end); - if (end != str.c_str() && *end == '\0' && value != HUGE_VAL) { + if (end != str.c_str() && *end == '\0' && value != HUGE_VAL && + value != -HUGE_VAL) { return value; } return {}; @@ -51,7 +53,8 @@ std::optional GetInt(const std::string &str) { char *end = nullptr; int value = std::strtol(str.c_str(), &end, 10); - if (end != str.c_str() && *end == '\0') { + if (end != str.c_str() && *end == '\0' && value != INT_MAX && + value != INT_MIN) { return value; } return {};