]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epggrab: channel mapper - handle better empty IDs, fixes #4699
authorJaroslav Kysela <perex@perex.cz>
Wed, 1 Nov 2017 15:31:57 +0000 (16:31 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 1 Nov 2017 15:33:09 +0000 (16:33 +0100)
src/epggrab/channel.c

index 7bbed97514d328776c4d3fbfbb9708ff5d455d4c..c2e1d5bfbee8e3f014db7cdaf8e7ca41fd4c7e21 100644 (file)
@@ -330,9 +330,6 @@ epggrab_channel_t *epggrab_channel_create
 {
   epggrab_channel_t *ec;
 
-  if (htsmsg_get_str(conf, "id") == NULL)
-    return NULL;
-
   ec = calloc(1, sizeof(*ec));
   if (idnode_insert(&ec->idnode, uuid, &epggrab_channel_class, 0)) {
     if (uuid)
@@ -350,6 +347,9 @@ epggrab_channel_t *epggrab_channel_create
   if (conf)
     idnode_load(&ec->idnode, conf);
 
+  if (ec->id == NULL)
+    ec->id = strdup("");
+
   TAILQ_INSERT_TAIL(&epggrab_channel_entries, ec, all_link);
   if (RB_INSERT_SORTED(&owner->channels, ec, link, _ch_id_cmp)) {
     tvherror(LS_EPGGRAB, "removing duplicate channel id '%s' (uuid '%s')", ec->id, uuid);
@@ -367,6 +367,11 @@ epggrab_channel_t *epggrab_channel_find
   char *s;
   epggrab_channel_t *ec;
 
+  if (id == NULL || id[0] == '\0') {
+    tvhwarn(LS_EPGGRAB, "%s: ignoring empty EPG id source", mod->id);
+    return NULL;
+  }
+
   SKEL_ALLOC(epggrab_channel_skel);
   s = epggrab_channel_skel->id = tvh_strdupa(id);