mirror of
https://github.com/xenia-project/xenia.git
synced 2026-04-20 22:13:40 +00:00
[Base] Fix Semaphore::Create invalid parameters
This commit is contained in:
parent
bb42829308
commit
e75e0eb39c
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue