SDL: Don't pass NULL to strncmp

From 2b0c0f5b6b58231c930704ac286df7b239152675 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Sat, 5 Aug 2023 18:48:38 +0200
Subject: [PATCH] Don't pass NULL to strncmp

---
 src/audio/alsa/SDL_alsa_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 9acab94b817a..66a3b3b00433 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -812,7 +812,7 @@ static void ALSA_HotplugIteration(SDL_bool *has_default_output, SDL_bool *has_de
 
                 // only want physical hardware interfaces
                 const SDL_bool is_default = (has_default == i) ? SDL_TRUE : SDL_FALSE;
-                if (is_default || SDL_strncmp(name, match, match_len) == 0) {
+                if (is_default || (match != NULL && SDL_strncmp(name, match, match_len) == 0)) {
                     char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID");
                     const SDL_bool isoutput = (ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0);
                     const SDL_bool isinput = (ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0);