3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2025-10-29 19:34:47 +00:00

config: fix crash when monitor position contains non-integer values before/after 'x' (#11573)

This commit is contained in:
Matteo Golinelli 2025-09-02 13:16:26 +02:00 committed by GitHub
parent 00423bb738
commit 78e86d879f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;