]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/tal.c
tal: tal_parent(NULL) should be NULL.
[ccan] / ccan / tal / tal.c
index 9fed477fe9595bd4e85d5243f1315c602915a830..ff25db19afb8a3b16da50ef254687a85b50cc71e 100644 (file)
@@ -638,7 +638,12 @@ tal_t *tal_next(const tal_t *root, const tal_t *prev)
 tal_t *tal_parent(const tal_t *ctx)
 {
         struct group *group;
-        struct tal_hdr *t = debug_tal(to_tal_hdr(ctx));
+        struct tal_hdr *t;
+
+       if (!ctx)
+               return NULL;
+
+       t = debug_tal(to_tal_hdr(ctx));
 
        while (!(group = find_property(t, GROUP)))
                t = t->next;