From d4a01bfef0da5b80ca25f0962b02cefacc283476 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 20 Apr 2022 14:07:30 -0400 Subject: [PATCH] os2: SDL_DestroyMutex should ignore NULL mutexes. Every other backend does this, so this should match, now. It's possible this was harmless, but we can avoid the system call and the (likely?) debug message when it fails, though! --- src/thread/os2/SDL_sysmutex.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/thread/os2/SDL_sysmutex.c b/src/thread/os2/SDL_sysmutex.c index 984ae10fe..d3fc7a3bd 100644 --- a/src/thread/os2/SDL_sysmutex.c +++ b/src/thread/os2/SDL_sysmutex.c @@ -56,12 +56,12 @@ SDL_CreateMutex(void) void SDL_DestroyMutex(SDL_mutex * mutex) { - ULONG ulRC; HMTX hMtx = (HMTX)mutex; - - ulRC = DosCloseMutexSem(hMtx); - if (ulRC != NO_ERROR) { - debug_os2("DosCloseMutexSem(), rc = %u", ulRC); + if (hMtx != NULLHANDLE) { + const ULONG ulRC = DosCloseMutexSem(hMtx); + if (ulRC != NO_ERROR) { + debug_os2("DosCloseMutexSem(), rc = %u", ulRC); + } } }