mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-27 06:12:17 +08:00
Fixed crash bug in CKeyState. Would deference bogus pointer in
isModifierActive if there's an unmapped toggle modifier.
This commit is contained in:
@@ -374,19 +374,21 @@ CKeyState::isModifierActive(KeyModifierMask mask) const
|
||||
{
|
||||
const KeyButtons& buttons = m_maskToKeys[getIndexForModifier(mask)];
|
||||
KeyButtons::const_iterator j = buttons.begin();
|
||||
if (isToggle(mask)) {
|
||||
// modifier is a toggle
|
||||
if ((m_keys[*j] & kToggled) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// modifier is not a toggle
|
||||
for (; j != buttons.end(); ++j) {
|
||||
if ((m_keys[*j] & kDown) != 0) {
|
||||
if (j != buttons.end()) {
|
||||
if (isToggle(mask)) {
|
||||
// modifier is a toggle
|
||||
if ((m_keys[*j] & kToggled) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// modifier is not a toggle
|
||||
for (; j != buttons.end(); ++j) {
|
||||
if ((m_keys[*j] & kDown) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user