]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
API: don't return error but empty reply when uuid is not found for /api/idnode/load...
authorJaroslav Kysela <perex@perex.cz>
Tue, 13 Oct 2015 06:45:39 +0000 (08:45 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 13 Oct 2015 06:45:39 +0000 (08:45 +0200)
src/api/api_idnode.c

index 3b88ae46f6ab9f06b61320a04e6fec764deb81c5..122fdf4082f822ef4c95ca508210e35758b25a64 100644 (file)
@@ -301,13 +301,11 @@ api_idnode_load
 
   /* Single */
   } else {
-    if (!(in = idnode_find(uuid, NULL, NULL)))
-      err = ENOENT;
-    else {
+    l = htsmsg_create_list();
+    if ((in = idnode_find(uuid, NULL, NULL)) != NULL) {
       if (idnode_perm(in, perm, NULL)) {
         err = EPERM;
       } else {
-        l = htsmsg_create_list();
         if (grid > 0) {
           m = htsmsg_create_map();
           htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(in));
@@ -323,9 +321,11 @@ api_idnode_load
     }
   }
 
-  if (l) {
+  if (l && err == 0) {
     *resp = htsmsg_create_map();
     htsmsg_add_msg(*resp, "entries", l);
+  } else {
+    htsmsg_destroy(l);
   }
 
   pthread_mutex_unlock(&global_lock);