audio: Don't crash if NULL positions are passed to gst_audio_info_set_format()

This commit is contained in:
Sebastian Dröge 2012-01-10 12:02:56 +01:00
parent 5cb3d75dbf
commit 67c8b0dfbd

View 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]));