From d73f04da139094fa8d7f3fe52c02215106ca396b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 3 Dec 2019 00:47:14 +0100 Subject: [PATCH] cellSaveData: avoid nullptr if there is no dialog --- rpcs3/Emu/Cell/Modules/cellSaveData.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index f5a7303c17..001dd50c84 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -168,7 +168,10 @@ static error_code select_and_delete(ppu_thread& ppu) lv2_obj::sleep(ppu); // Display Save Data List asynchronously in the GUI thread. - selected = Emu.GetCallbacks().get_save_dialog()->ShowSaveDataList(save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null); + if (auto save_dialog = Emu.GetCallbacks().get_save_dialog()) + { + selected = save_dialog->ShowSaveDataList(save_entries, focused, SAVEDATA_OP_LIST_DELETE, vm::null); + } // Reschedule if (ppu.check_state()) @@ -176,8 +179,8 @@ static error_code select_and_delete(ppu_thread& ppu) return 0; } - // Abort if dialog was canceled - if (selected == -2) + // Abort if dialog was canceled or selection is invalid in this context + if (selected < 0) { return CELL_CANCEL; }