fixed possible nullptr crash on rwlock create

This commit is contained in:
georgemoralis 2024-06-10 18:01:50 +03:00
parent 81a1cbf6b1
commit 3318f12639
1 changed files with 3 additions and 1 deletions

View File

@ -201,7 +201,9 @@ int PS4_SYSV_ABI scePthreadRwlockInit(OrbisPthreadRwlock* rwlock,
if (attr == nullptr || *attr == nullptr) { if (attr == nullptr || *attr == nullptr) {
attr = g_pthread_cxt->getDefaultRwattr(); attr = g_pthread_cxt->getDefaultRwattr();
} }
if (name != nullptr) {
(*rwlock)->name = name; (*rwlock)->name = name;
}
int result = pthread_rwlock_init(&(*rwlock)->pth_rwlock, &(*attr)->attr_rwlock); int result = pthread_rwlock_init(&(*rwlock)->pth_rwlock, &(*attr)->attr_rwlock);
if (result != 0) { if (result != 0) {
LOG_ERROR(Kernel_Pthread, "scePthreadRwlockInit: error = {}", result); LOG_ERROR(Kernel_Pthread, "scePthreadRwlockInit: error = {}", result);