Mercurial > repos > blastem
diff tern.c @ 2217:8483c685cf03
Allow tern_foreach on an empty (NULL) ternary tree
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 30 Aug 2022 18:43:08 -0700 |
parents | de3d20e58555 |
children |
line wrap: on
line diff
--- 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);