diff options
| author | Matteo Golinelli <34921879+Golim@users.noreply.github.com> | 2025-09-02 13:16:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-02 13:16:26 +0200 |
| commit | 78e86d879fa9bf3afeb73b29a3e668d47df5e9ab (patch) | |
| tree | 09dd142865dfc0c15fba8a5ac58dec8f0708e7be /src | |
| parent | 00423bb738d568f4903412fdabdf53e2c63fde7c (diff) | |
config: fix crash when monitor position contains non-integer values before/after 'x' (#11573)
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/ConfigManager.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 3e75f2ab..9277b89b 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2196,8 +2196,14 @@ bool CMonitorRuleParser::parsePosition(const std::string& value, bool isFirst) { m_rule.offset = Vector2D(-INT32_MAX, -INT32_MAX); return false; } else { - m_rule.offset.x = stoi(value.substr(0, value.find_first_of('x'))); - m_rule.offset.y = stoi(value.substr(value.find_first_of('x') + 1)); + try { + m_rule.offset.x = stoi(value.substr(0, value.find_first_of('x'))); + m_rule.offset.y = stoi(value.substr(value.find_first_of('x') + 1)); + } catch (...) { + m_error += "invalid offset "; + m_rule.offset = Vector2D(-INT32_MAX, -INT32_MAX); + return false; + } } } return true; |
