]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Avoid NULL ptr deref
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 5 Oct 2010 19:47:33 +0000 (19:47 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 5 Oct 2010 19:47:33 +0000 (19:47 +0000)
src/dvr/mkmux.c

index d19dd489c3e032dee2ebb981411d888a56c9f0f4..d9930d252302873a9085188cd0b2174cedc6543f 100644 (file)
@@ -432,7 +432,7 @@ mk_build_metadata(const dvr_entry_t *de)
   htsbuf_queue_t *q = htsbuf_queue_alloc(0);
   char datestr[64];
   struct tm tm;
-
+  const char *ctype;
   localtime_r(&de->de_start, &tm);
 
   snprintf(datestr, sizeof(datestr),
@@ -448,10 +448,12 @@ mk_build_metadata(const dvr_entry_t *de)
 
   addtag(q, build_tag_string("ORIGINAL_MEDIA_TYPE", "TV", 0, NULL));
 
-  if(de->de_content_type)
-    addtag(q, build_tag_string("CONTENT_TYPE", 
-                              epg_content_group_get_name(de->de_content_type),
-                              0, NULL));
+  
+  if(de->de_content_type) {
+    ctype = epg_content_group_get_name(de->de_content_type);
+    if(ctype != NULL)
+      addtag(q, build_tag_string("CONTENT_TYPE", ctype, 0, NULL));
+  }
 
   if(de->de_channel != NULL)
     addtag(q, build_tag_string("TVCHANNEL", de->de_channel->ch_name, 0, NULL));