mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-26 16:09:49 +01:00
inputmgr: ensure we dont divide by zero (#6713)
some weird combination of scrolling/nesting hyprland and closing a window i managed to divide by zero here, reported by ubsan. add a check to ensure we dont hit UB.
This commit is contained in:
parent
718afe271e
commit
8ff9410d2c
1 changed files with 1 additions and 1 deletions
|
@ -798,7 +798,7 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
|
|||
}
|
||||
}
|
||||
}
|
||||
double deltaDiscrete = factor * e.deltaDiscrete / std::abs(e.deltaDiscrete);
|
||||
double deltaDiscrete = (e.deltaDiscrete != 0) ? (factor * e.deltaDiscrete / std::abs(e.deltaDiscrete)) : 0;
|
||||
g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, factor * e.delta, deltaDiscrete > 0 ? std::ceil(deltaDiscrete) : std::floor(deltaDiscrete),
|
||||
std::round(factor * e.deltaDiscrete), e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue