Skip to content

Commit

Permalink
Merge ddnet#6759
Browse files Browse the repository at this point in the history
6759: Fix bind crashes (fixes ddnet#6758) r=Robyt3 a=def-

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
  • Loading branch information
bors[bot] and def- committed Jun 23, 2023
2 parents 47f1904 + e320c85 commit f54c6cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/game/client/components/binds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ bool CBinds::OnInput(const IInput::CEvent &Event)
{
if(Event.m_Flags & IInput::FLAG_PRESS)
Console()->ExecuteLineStroked(1, m_aapKeyBindings[Mask][Event.m_Key]);
if(Event.m_Flags & IInput::FLAG_RELEASE)
// Have to check for nullptr again because the previous execute can unbind itself
if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[Mask][Event.m_Key])
Console()->ExecuteLineStroked(0, m_aapKeyBindings[Mask][Event.m_Key]);
ret = true;
}
Expand All @@ -148,7 +149,8 @@ bool CBinds::OnInput(const IInput::CEvent &Event)
// When ctrl+shift are pressed (ctrl+shift binds and also the hard-coded ctrl+shift+d, ctrl+shift+g, ctrl+shift+e), ignore other +xxx binds
if(Event.m_Flags & IInput::FLAG_PRESS && Mask != ((1 << MODIFIER_CTRL) | (1 << MODIFIER_SHIFT)) && Mask != ((1 << MODIFIER_GUI) | (1 << MODIFIER_SHIFT)))
Console()->ExecuteLineStroked(1, m_aapKeyBindings[0][Event.m_Key]);
if(Event.m_Flags & IInput::FLAG_RELEASE)
// Have to check for nullptr again because the previous execute can unbind itself
if(Event.m_Flags & IInput::FLAG_RELEASE && m_aapKeyBindings[0][Event.m_Key])
Console()->ExecuteLineStroked(0, m_aapKeyBindings[0][Event.m_Key]);
ret = true;
}
Expand Down

0 comments on commit f54c6cd

Please sign in to comment.