Don't pass NULL to strncmp

This commit is contained in:
Mathieu Eyraud 2023-08-05 18:48:38 +02:00 committed by Ryan C. Gordon
parent 778e8185cd
commit 2b0c0f5b6b
1 changed files with 1 additions and 1 deletions

View File

@ -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);