Skip to content

Commit 00ca0f4

Browse files
committed
rg_gui: Fixed a crash when Emulator Options is empty
1 parent 688df47 commit 00ca0f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

components/retro-go/rg_gui.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ intptr_t rg_gui_dialog(const char *title, const rg_gui_option_t *options_const,
895895

896896
if (joystick ^ joystick_old)
897897
{
898-
bool active_selection = options[sel].flags == RG_DIALOG_FLAG_NORMAL;
898+
bool active_selection = options_count && options[sel].flags == RG_DIALOG_FLAG_NORMAL;
899899
rg_gui_callback_t callback = active_selection ? options[sel].update_cb : NULL;
900900

901901
if (joystick & RG_KEY_UP) {
@@ -1954,7 +1954,10 @@ static rg_gui_event_t app_options_cb(rg_gui_option_t *option, rg_gui_event_t eve
19541954
if (event == RG_DIALOG_ENTER)
19551955
{
19561956
const rg_app_t *app = rg_system_get_app();
1957-
rg_gui_option_t options[16] = {0};
1957+
rg_gui_option_t options[16] = {
1958+
{0, _("None"), NULL, RG_DIALOG_FLAG_MESSAGE, 0},
1959+
RG_DIALOG_END,
1960+
};
19581961
if (app->handlers.options)
19591962
app->handlers.options(options);
19601963
rg_display_force_redraw();

0 commit comments

Comments
 (0)