mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 09:12:46 +01:00
WaitSynchronizationN: Handle case where handle_count is invalid.
This commit is contained in:
parent
064be2b86f
commit
f5c6d367c9
1 changed files with 7 additions and 3 deletions
|
@ -148,8 +148,12 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
|
||||||
bool wait_all_succeeded = false;
|
bool wait_all_succeeded = false;
|
||||||
int handle_index = 0;
|
int handle_index = 0;
|
||||||
|
|
||||||
// If handles were passed in, iterate through them and wait/acquire the objects as needed
|
// Negative handle_count is invalid
|
||||||
if (handle_count > 0) {
|
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) {
|
while (handle_index < handle_count) {
|
||||||
SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]);
|
SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]);
|
||||||
if (object == nullptr)
|
if (object == nullptr)
|
||||||
|
|
Loading…
Reference in a new issue