diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-01-20 16:06:08 +1000 |
|---|---|---|
| committer | Mike Lothian <mike@fireburn.co.uk> | 2025-05-11 12:17:03 +0100 |
| commit | 7f1e5090e9a77af93049e778f271c378bde79f15 (patch) | |
| tree | bb1d12e1723b3f1968cb8d889dc32bac4af5e0d7 | |
| parent | bc82a4f41b71c4b06fc702725eacb4d473fa8ba0 (diff) | |
service-am: Handle panic conditions in SetTerminateResult
- Prevents propagation of panic conditions when setting termination results
- Previously, panic error codes could trigger cascading crashes
- Only stores non-error termination results while allowing successful completion
- Fixes crash when applications set panic-related termination codes (0x1A80A)
| -rw-r--r-- | src/core/hle/service/am/service/application_functions.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 6fcda9165..30c2715a6 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -181,13 +181,16 @@ Result IApplicationFunctions::GetDesiredLanguage(Out<u64> out_language_code) { } Result IApplicationFunctions::SetTerminateResult(Result terminate_result) { - LOG_INFO(Service_AM, "(STUBBED) called, result={:#x} ({:04}-{:04})", + LOG_INFO(Service_AM, "called, result={:#x} ({:04}-{:04})", terminate_result.GetInnerValue(), static_cast<u32>(terminate_result.GetModule()) + 2000, terminate_result.GetDescription()); - std::scoped_lock lk{m_applet->lock}; - m_applet->terminate_result = terminate_result; + // Only set the terminate result if it's not a panic + if (!terminate_result.IsError()) { + std::scoped_lock lk{m_applet->lock}; + m_applet->terminate_result = terminate_result; + } R_SUCCEED(); } |
