Check there is a stream before writing header.
authorTomas Härdin <Tomas.hardin@codemill.se>
Wed, 13 Jan 2010 14:32:48 +0000 (14:32 +0000)
committerBenoit Fouet <benoit.fouet@free.fr>
Wed, 13 Jan 2010 14:32:48 +0000 (14:32 +0000)
Patch by Tomas Härdin: $(name) punto hardin chez codemill dot se

Originally committed as revision 21186 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index b903337..000ab90 100644 (file)
@@ -2501,6 +2501,11 @@ int av_write_header(AVFormatContext *s)
     AVStream *st;
 
     // some sanity checks
+    if (s->nb_streams == 0) {
+        av_log(s, AV_LOG_ERROR, "no streams\n");
+        return -1;
+    }
+
     for(i=0;i<s->nb_streams;i++) {
         st = s->streams[i];