SDL: audio: Fixed logic error

https://github.com/libsdl-org/SDL/commit/f94ffd609206c945440dddd9a7e3e2409049505e

From f94ffd609206c945440dddd9a7e3e2409049505e Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 4 Jul 2023 17:27:09 -0400
Subject: [PATCH] audio: Fixed logic error

---
 src/audio/SDL_audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 87c4df866523..342024b791e2 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -475,7 +475,7 @@ static SDL_AudioDeviceID GetFirstAddedAudioDeviceID(const SDL_bool iscapture)
     // (these are pushed to the front of the linked list as added, so the first device added is last in the list.)
     SDL_LockRWLockForReading(current_audio.device_list_lock);
     SDL_AudioDevice *last = NULL;
-    for (SDL_AudioDevice *i = current_audio.output_devices; i != NULL; i = i->next) {
+    for (SDL_AudioDevice *i = iscapture ? current_audio.capture_devices : current_audio.output_devices; i != NULL; i = i->next) {
         last = i;
     }
     const SDL_AudioDeviceID retval = last ? last->instance_id : 0;
@@ -599,8 +599,8 @@ int SDL_InitAudio(const char *driver_name)
     if (!current_audio.default_output_device_id) {
         current_audio.default_output_device_id = GetFirstAddedAudioDeviceID(/*iscapture=*/SDL_FALSE);
     }
-    if (!current_audio.default_capture_device_id && (current_audio.capture_devices != NULL)) {
-        current_audio.default_output_device_id = GetFirstAddedAudioDeviceID(/*iscapture=*/SDL_TRUE);
+    if (!current_audio.default_capture_device_id) {
+        current_audio.default_capture_device_id = GetFirstAddedAudioDeviceID(/*iscapture=*/SDL_TRUE);
     }
 
     return 0;