SDL: Fix refcounting in SDL_hid_exit

From 5fc7a90a8b5f9a9ef008e0485f9f29f249973841 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Fri, 12 Nov 2021 10:00:41 +0100
Subject: [PATCH] Fix refcounting in SDL_hid_exit

---
 src/hidapi/SDL_hidapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 28003b40fa..2ed4678b17 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -1084,8 +1084,8 @@ int SDL_hid_exit(void)
     if (SDL_hidapi_refcount == 0) {
         return 0;
     }
+    --SDL_hidapi_refcount;
     if (SDL_hidapi_refcount > 0) {
-        --SDL_hidapi_refcount;
         return 0;
     }
     SDL_hidapi_refcount = 0;