1
0
Эх сурвалжийг харах

Fix #13276: Crash in SDL_GetAudioDeviceChannelMap

Paul Vick 8 сар өмнө
parent
commit
de6a23028a
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  1. 3 1
      src/audio/SDL_audio.c

+ 3 - 1
src/audio/SDL_audio.c

@@ -1606,7 +1606,9 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count)
     SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
     if (device) {
         channels = device->spec.channels;
-        result = SDL_ChannelMapDup(device->chmap, channels);
+        if (channels > 0 && device->chmap) {
+            result = SDL_ChannelMapDup(device->chmap, channels);
+        }
     }
     ReleaseAudioDevice(device);