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:
parent
00423bb738
commit
78e86d879f
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user