# HG changeset patch # User Michael Pavone # Date 1661910188 25200 # Node ID 8483c685cf03fdea1e3a39af69085b8bd969ce0b # Parent 4e27c36f947c65803ff3fde5effdff02ff65e945 Allow tern_foreach on an empty (NULL) ternary tree diff -r 4e27c36f947c -r 8483c685cf03 tern.c --- a/tern.c Tue Aug 30 18:42:45 2022 -0700 +++ b/tern.c Tue Aug 30 18:43:08 2022 -0700 @@ -286,6 +286,9 @@ void tern_foreach(tern_node *head, iter_fun fun, void *data) { + if (!head) { + return; + } //lame, but good enough for my purposes char key[MAX_ITER_KEY+1]; tern_foreach_int(head, fun, data, key, 0);