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.
This commit is contained in:
Lee Salzman 2021-08-29 15:24:23 -04:00 committed by Ozkan Sezer
parent b9bf7ffec7
commit 7d90df0ece

View File

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