diff --git a/src/xenia/base/threading_posix.cc b/src/xenia/base/threading_posix.cc index 4e8fdfd51..fac86abc8 100644 --- a/src/xenia/base/threading_posix.cc +++ b/src/xenia/base/threading_posix.cc @@ -975,6 +975,10 @@ class PosixSemaphore : public PosixConditionHandle { std::unique_ptr Semaphore::Create(int initial_count, int maximum_count) { + if (initial_count < 0 || initial_count > maximum_count || + maximum_count <= 0) { + return nullptr; + } return std::make_unique(initial_count, maximum_count); }