mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[Base] Fix Semaphore::Create invalid parameters
This commit is contained in:
parent
bb42829308
commit
e75e0eb39c
|
|
@ -975,6 +975,10 @@ class PosixSemaphore : public PosixConditionHandle<Semaphore> {
|
|||
|
||||
std::unique_ptr<Semaphore> 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<PosixSemaphore>(initial_count, maximum_count);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue