core: backport some ResultCode updates (#6645)

Co-authored-by: Lioncash <mathew1800@gmail.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
GPUCode
2023-07-03 03:23:53 +03:00
committed by GitHub
parent 0b37c1da57
commit 2126c240cd
34 changed files with 1204 additions and 277 deletions

View File

@ -674,7 +674,7 @@ ResultCode SVC::OpenProcess(Handle* out_handle, u32 process_id) {
return ResultCode(24, ErrorModule::OS, ErrorSummary::WrongArgument, ErrorLevel::Permanent);
}
auto result_handle = kernel.GetCurrentProcess()->handle_table.Create(process);
if (result_handle.empty()) {
if (!result_handle) {
return result_handle.Code();
}
*out_handle = result_handle.Unwrap();
@ -699,7 +699,7 @@ ResultCode SVC::OpenThread(Handle* out_handle, Handle process_handle, u32 thread
for (auto& thread : thread_list) {
if (thread->owner_process.lock() == process && thread.get()->thread_id == thread_id) {
auto result_handle = kernel.GetCurrentProcess()->handle_table.Create(thread);
if (result_handle.empty()) {
if (!result_handle) {
return result_handle.Code();
}
*out_handle = result_handle.Unwrap();