SDL: Set the output value for ParseExtensionResponse() in all return cases

From 785d784a9308e395f1617bc14f39d5b2f3639159 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 1 Sep 2022 22:30:05 -0700
Subject: [PATCH] Set the output value for ParseExtensionResponse() in all
 return cases

---
 src/joystick/hidapi/SDL_hidapi_wii.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c
index eeaa9ea6766..33978cd6cc4 100644
--- a/src/joystick/hidapi/SDL_hidapi_wii.c
+++ b/src/joystick/hidapi/SDL_hidapi_wii.c
@@ -259,6 +259,8 @@ static SDL_bool ParseExtensionResponse(SDL_DriverWii_Context *ctx, EWiiExtension
     Uint64 type = 0;
     int i;
 
+    *controller_type = k_eWiiExtensionControllerType_Unknown;
+
     SDL_assert(ctx->m_rgucReadBuffer[0] == k_eWiiInputReportIDs_ReadMemory);
     if (ctx->m_rgucReadBuffer[4] != 0x00 || ctx->m_rgucReadBuffer[5] != 0xFA) {
         SDL_SetError("Unexpected extension response address");
@@ -294,7 +296,6 @@ static SDL_bool ParseExtensionResponse(SDL_DriverWii_Context *ctx, EWiiExtension
         return SDL_TRUE;
     }
 
-    *controller_type = k_eWiiExtensionControllerType_Unknown;
     SDL_SetError("Unrecognized controller type: %012" SDL_PRIx64, type);
     return SDL_FALSE;
 }