Fixed crash bug in CKeyState. Would deference bogus pointer in

isModifierActive if there's an unmapped toggle modifier.
This commit is contained in:
crs 2004-03-30 18:55:58 +00:00
parent ceb654246c
commit 610518104b
1 changed files with 12 additions and 10 deletions

View File

@ -374,6 +374,7 @@ CKeyState::isModifierActive(KeyModifierMask mask) const
{ {
const KeyButtons& buttons = m_maskToKeys[getIndexForModifier(mask)]; const KeyButtons& buttons = m_maskToKeys[getIndexForModifier(mask)];
KeyButtons::const_iterator j = buttons.begin(); KeyButtons::const_iterator j = buttons.begin();
if (j != buttons.end()) {
if (isToggle(mask)) { if (isToggle(mask)) {
// modifier is a toggle // modifier is a toggle
if ((m_keys[*j] & kToggled) != 0) { if ((m_keys[*j] & kToggled) != 0) {
@ -388,6 +389,7 @@ CKeyState::isModifierActive(KeyModifierMask mask) const
} }
} }
} }
}
return false; return false;
} }