From 580b1f43458511f5a5b2047456b7053f5fda0900 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Fri, 27 Dec 2024 10:25:20 +0100 Subject: [PATCH] [XAM] Fixed nullptr crash in XamShowMessageBoxUI --- src/xenia/kernel/xam/xam_ui.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/xenia/kernel/xam/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc index 7d2803e88..e4c1f5d00 100644 --- a/src/xenia/kernel/xam/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -784,12 +784,8 @@ static dword_result_t XamShowMessageBoxUi( dword_t user_index, lpu16string_t title_ptr, lpu16string_t text_ptr, dword_t button_count, lpdword_t button_ptrs, dword_t active_button, dword_t flags, lpdword_t result_ptr, pointer_t overlapped) { - std::string title; - if (title_ptr) { - title = xe::to_utf8(title_ptr.value()); - } else { - title = ""; // TODO(gibbed): default title based on flags? - } + std::string title = title_ptr ? xe::to_utf8(title_ptr.value()) : ""; + std::string text = text_ptr ? xe::to_utf8(text_ptr.value()) : ""; std::vector buttons; for (uint32_t i = 0; i < button_count; ++i) { @@ -830,7 +826,6 @@ static dword_result_t XamShowMessageBoxUi( const Emulator* emulator = kernel_state()->emulator(); ui::ImGuiDrawer* imgui_drawer = emulator->imgui_drawer(); - auto text = xe::to_utf8(text_ptr.value()); result = xeXamDispatchDialog( new MessageBoxDialog(imgui_drawer, title, text, buttons, static_cast(active_button)),