summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/gif.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 7916ba1e6b..e125d386bd 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -174,6 +174,9 @@ static int gif_write_trailer(AVFormatContext *s)
GIFContext *gif = s->priv_data;
AVIOContext *pb = s->pb;
+ if (!gif->prev_pkt)
+ return AVERROR(EINVAL);
+
gif_write_packet(s, NULL);
if (!gif->have_end)