ffprobe: print codec_long_name only when available
authorStefano Sabatini <stefasab@gmail.com>
Fri, 21 Sep 2012 07:25:46 +0000 (09:25 +0200)
committerStefano Sabatini <stefasab@gmail.com>
Fri, 21 Sep 2012 07:27:06 +0000 (09:27 +0200)
Avoid possible segmentation fault if codec_long_name is defined as
NULL (for example if --enable-small).

ffprobe.c

index 01576c1..5078365 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1656,7 +1656,8 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
         const char *profile = NULL;
         if ((dec = dec_ctx->codec)) {
             print_str("codec_name",      dec->name);
-            print_str("codec_long_name", dec->long_name);
+            if (dec->long_name) print_str    ("codec_long_name", dec->long_name);
+            else                print_str_opt("codec_long_name", "unknown");
         } else {
             print_str_opt("codec_name",      "unknown");
             print_str_opt("codec_long_name", "unknown");