diff options
author | Zephyron <zephyron@citron-emu.org> | 2025-01-20 16:06:08 +1000 |
---|---|---|
committer | Zephyron <zephyron@citron-emu.org> | 2025-01-20 16:06:08 +1000 |
commit | b574aba98b6714b9229a3b0fadf5aaf92851dd51 (patch) | |
tree | dd7719e16ec11be7065d2e28b08418529fa6cace /src/core | |
parent | 6d225eb94a63f5515b8313ac096a34c0005445ed (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)
Diffstat (limited to 'src/core')
-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(); } |