From 7d90df0ecea3885bb6ca331202bcbe849a60881b Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 29 Aug 2021 15:24:23 -0400 Subject: [PATCH] Restore previous behavior of empty SDL_AUDIODRIVER trying all drivers. The recent change to make SDL_AUDIODRIVER support comma-separated lists broke the previous behavior where an SDL_AUDIODRIVER that was empty behaved the same as if it was not set at all. This old behavior was necessary to paper over differences in platforms where SDL_setenv may or may not actually delete the env var if an empty string is specified. This patch just adds a simple check to ensure SDL_AUDIODRIVER is not empty before using it, restoring the old interpretation of the empty var. --- src/audio/SDL_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 972207d366..5241c8ee10 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -972,7 +972,7 @@ SDL_AudioInit(const char *driver_name) driver_name = SDL_getenv("SDL_AUDIODRIVER"); } - if (driver_name != NULL) { + if (driver_name != NULL && *driver_name != 0) { const char *driver_attempt = driver_name; while (driver_attempt != NULL && *driver_attempt != 0 && !initialized) { const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');