lavfi/buffersrc: do not dereference NULL frame.

frame = NULL is used to indicate EOF.
This commit is contained in:
Nicolas George 2013-03-10 16:28:33 +01:00
parent 03b87fe5e3
commit b71db3f38e

View File

@ -93,9 +93,9 @@ int av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags
{ {
AVFrame *copy = NULL; AVFrame *copy = NULL;
int ret = 0; int ret = 0;
int64_t layout = frame->channel_layout;
if (layout && av_get_channel_layout_nb_channels(layout) != av_frame_get_channels(frame)) { if (frame && frame->channel_layout &&
av_get_channel_layout_nb_channels(frame->channel_layout) != av_frame_get_channels(frame)) {
av_log(0, AV_LOG_ERROR, "Layout indicates a different number of channels than actually present\n"); av_log(0, AV_LOG_ERROR, "Layout indicates a different number of channels than actually present\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }