mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 17:10:04 +01:00
config: fix crash when monitor position contains non-integer values before/after 'x' (#11573)
This commit is contained in:
parent
00423bb738
commit
78e86d879f
1 changed files with 8 additions and 2 deletions
|
|
@ -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…
Add table
Reference in a new issue