audio: Don't crash if NULL positions are passed to gst_audio_info_set_format()
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 10 Jan 2012 11:02:56 +0000 (12:02 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 10 Jan 2012 11:02:56 +0000 (12:02 +0100)
gst-libs/gst/audio/audio.c

index f0acfb5..b6b0679 100644 (file)
@@ -484,8 +484,10 @@ gst_audio_info_set_format (GstAudioInfo * info, GstAudioFormat format,
     info->position[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
     return;
   } else {
-    if (!check_valid_channel_positions (position, channels, TRUE, NULL)) {
-      g_warning ("Invalid channel positions");
+    if (!position
+        || !check_valid_channel_positions (position, channels, TRUE, NULL)) {
+      if (position)
+        g_warning ("Invalid channel positions");
     } else {
       memcpy (&info->position, position,
           info->channels * sizeof (info->position[0]));