diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-07-13 13:59:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-13 13:59:59 +0200 |
| commit | 89a03174ccfcc0dc80c9f59b84338f508919a555 (patch) | |
| tree | 049819298c9ff45f3ffcf240667b4dc8c460bfce /Source/Core/Common/StringUtil.cpp | |
| parent | baf9abe9115fe444689f9a773fe814b1fc83956d (diff) | |
| parent | 213373f5f9c582dfcce07f4cde3eaa41e96f034a (diff) | |
Merge pull request #4001 from leoetlino/split-controller-setting
ControllerEmu: Split the Setting class
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 6f50afce3e..ff6c6074cf 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -247,9 +247,11 @@ bool TryParse(const std::string& str, u32* const output) bool TryParse(const std::string& str, bool* const output) { - if ("1" == str || !strcasecmp("true", str.c_str())) + float value; + const bool is_valid_float = TryParse(str, &value); + if ((is_valid_float && value == 1) || !strcasecmp("true", str.c_str())) *output = true; - else if ("0" == str || !strcasecmp("false", str.c_str())) + else if ((is_valid_float && value == 0) || !strcasecmp("false", str.c_str())) *output = false; else return false; |
