diff --git a/Release/com.ctytler.dcs.streamDeckPlugin b/Release/com.ctytler.dcs.streamDeckPlugin index 959121e9..d9750dba 100644 Binary files a/Release/com.ctytler.dcs.streamDeckPlugin and b/Release/com.ctytler.dcs.streamDeckPlugin differ diff --git a/Sources/DcsInterface/StringUtilities.cpp b/Sources/DcsInterface/StringUtilities.cpp index 1bc7b647..9fc5efdd 100644 --- a/Sources/DcsInterface/StringUtilities.cpp +++ b/Sources/DcsInterface/StringUtilities.cpp @@ -6,29 +6,31 @@ #include bool is_integer(const std::string &str) { - if (str.empty()) { - return false; - } else { + if (!str.empty()) { // Add special handling for stripping of trailing spaces const std::string str_trailing_spaces_stripped = str.substr(0, str.find_last_not_of(" ") + 1); - // Check if all characters are base 10 digits (0-9). - char *ptr_to_first_non_numeric_char; - strtol(str_trailing_spaces_stripped.c_str(), &ptr_to_first_non_numeric_char, 10); - return (*ptr_to_first_non_numeric_char == '\0'); + if (!str_trailing_spaces_stripped.empty()) { + // Check if all characters are base 10 digits (0-9). + char *ptr_to_first_non_numeric_char; + strtol(str_trailing_spaces_stripped.c_str(), &ptr_to_first_non_numeric_char, 10); + return (*ptr_to_first_non_numeric_char == '\0'); + } } + return false; } bool is_number(const std::string &str) { - if (str.empty()) { - return false; - } else { + if (!str.empty()) { // Add special handling for stripping of trailing spaces const std::string str_trailing_spaces_stripped = str.substr(0, str.find_last_not_of(" ") + 1); - // Check if all characters can be converted to a floating point number. - char *ptr_to_first_non_numeric_char; - strtof(str_trailing_spaces_stripped.c_str(), &ptr_to_first_non_numeric_char); - return (*ptr_to_first_non_numeric_char == '\0'); + if (!str_trailing_spaces_stripped.empty()) { + // Check if all characters can be converted to a floating point number. + char *ptr_to_first_non_numeric_char; + strtof(str_trailing_spaces_stripped.c_str(), &ptr_to_first_non_numeric_char); + return (*ptr_to_first_non_numeric_char == '\0'); + } } + return false; } bool pop_key_and_value(std::stringstream &ss, diff --git a/Sources/com.ctytler.dcs.sdPlugin/dcs_interface.exe b/Sources/com.ctytler.dcs.sdPlugin/dcs_interface.exe index e1acec5a..bb41ebfe 100644 Binary files a/Sources/com.ctytler.dcs.sdPlugin/dcs_interface.exe and b/Sources/com.ctytler.dcs.sdPlugin/dcs_interface.exe differ