OSDN Git Service

Add missing NULL checks, fix crash.
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Fri, 24 Sep 2010 20:01:38 +0000 (20:01 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Fri, 24 Sep 2010 20:01:38 +0000 (20:01 +0000)
Originally committed as revision 25181 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/defaults.c

index 7e44901..cb9ed19 100644 (file)
@@ -282,8 +282,8 @@ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
 
 int avfilter_default_query_formats(AVFilterContext *ctx)
 {
-    enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type :
-                            ctx->outputs[0] ? ctx->outputs[0]->type :
+    enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :
+                            ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
                             AVMEDIA_TYPE_VIDEO;
 
     avfilter_set_common_formats(ctx, avfilter_all_formats(type));