diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-17 18:35:55 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-22 01:09:09 +0100 |
commit | f5c6d367c9634291aeea7604c2a14a80144f7dc0 (patch) | |
tree | c78642004a163950da892ae89bb532fae74248c8 /src/core/hle/svc.cpp | |
parent | WaitSynchronizationN: Handle case where handle_count=0. (diff) | |
download | yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar.gz yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar.bz2 yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar.lz yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar.xz yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.tar.zst yuzu-f5c6d367c9634291aeea7604c2a14a80144f7dc0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/svc.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index f8a5b2548..637c63b91 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -148,8 +148,12 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all_succeeded = false; int handle_index = 0; - // If handles were passed in, iterate through them and wait/acquire the objects as needed - if (handle_count > 0) { + // Negative handle_count is invalid + if (handle_count < 0) + return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage).raw; + + // If handle_count is non-zero, iterate through them and wait/acquire the objects as needed + if (handle_count != 0) { while (handle_index < handle_count) { SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]); if (object == nullptr) @@ -172,7 +176,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, handle_index++; } - }else { + } else { // If no handles were passed in, put the thread to sleep only when wait_all=false // NOTE: This is supposed to deadlock if no timeout was specified if (!wait_all) { |