diff --git a/src/gba/gba-input.c b/src/gba/gba-input.c index 5bd8c27c8..80b640179 100644 --- a/src/gba/gba-input.c +++ b/src/gba/gba-input.c @@ -312,6 +312,9 @@ void GBAInputBindKey(struct GBAInputMap* map, uint32_t type, int key, enum GBAKe void GBAInputUnbindKey(struct GBAInputMap* map, uint32_t type, enum GBAKey input) { struct GBAInputMapImpl* impl = _lookupMap(map, type); + if (input < 0 || input >= GBA_KEY_MAX) { + return; + } if (impl) { impl->map[input] = GBA_NO_MAPPING; }