summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/svc.cpp10
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,
148 bool wait_all_succeeded = false; 148 bool wait_all_succeeded = false;
149 int handle_index = 0; 149 int handle_index = 0;
150 150
151 // If handles were passed in, iterate through them and wait/acquire the objects as needed 151 // Negative handle_count is invalid
152 if (handle_count > 0) { 152 if (handle_count < 0)
153 return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, ErrorSummary::InvalidArgument, ErrorLevel::Usage).raw;
154
155 // If handle_count is non-zero, iterate through them and wait/acquire the objects as needed
156 if (handle_count != 0) {
153 while (handle_index < handle_count) { 157 while (handle_index < handle_count) {
154 SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]); 158 SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]);
155 if (object == nullptr) 159 if (object == nullptr)
@@ -172,7 +176,7 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
172 176
173 handle_index++; 177 handle_index++;
174 } 178 }
175 }else { 179 } else {
176 // If no handles were passed in, put the thread to sleep only when wait_all=false 180 // If no handles were passed in, put the thread to sleep only when wait_all=false
177 // NOTE: This is supposed to deadlock if no timeout was specified 181 // NOTE: This is supposed to deadlock if no timeout was specified
178 if (!wait_all) { 182 if (!wait_all) {