Skip to content

Commit de6a230

Browse files
panopticoncentralicculus
authored andcommitted
Fix #13276: Crash in SDL_GetAudioDeviceChannelMap
1 parent 8442d4f commit de6a230

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/audio/SDL_audio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,9 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count)
16061606
SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
16071607
if (device) {
16081608
channels = device->spec.channels;
1609-
result = SDL_ChannelMapDup(device->chmap, channels);
1609+
if (channels > 0 && device->chmap) {
1610+
result = SDL_ChannelMapDup(device->chmap, channels);
1611+
}
16101612
}
16111613
ReleaseAudioDevice(device);
16121614

0 commit comments

Comments
 (0)