From c0d0eb9dd0ffc1165e035abe1eb9bae94b3839ce Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 17 Aug 2021 16:16:23 -0700 Subject: [PATCH] Libretro: Fix crash when using Game Boy codes (fixes #2281) --- CHANGES | 1 + src/platform/libretro/libretro.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 13109f5fe..0b83173ea 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Emulation fixes: Other fixes: - GB Video: Fix memory leak when reseting SGB games - GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB + - Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281) - Qt: Remove potentially deadlocking optimization 0.9.2: (2021-07-10) diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index aad9fba7e..25c465dbc 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -871,7 +871,9 @@ void retro_cheat_set(unsigned index, bool enabled, const char* code) { } } #endif - cheatSet->refresh(cheatSet, device); + if (cheatSet->refresh) { + cheatSet->refresh(cheatSet, device); + } } unsigned retro_get_region(void) {