diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-04-24 11:36:51 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-04-24 11:36:51 -0400 |
commit | 4a802da8d598c6fe3317e186b64a0b020cc96f01 (patch) | |
tree | 93f66529a379ff537752cd25d730d0d82e8450f6 /src | |
parent | 03220724981ab4e4e2be239b65dec440f008f7da (diff) | |
download | bfs-4a802da8d598c6fe3317e186b64a0b020cc96f01.tar.xz |
opt: Add missing NULL check in visit_shallow()
visit_shallow() should propagate NULL, but look_up_visitor()
dereferences expr to know which visitor to return.
Diffstat (limited to 'src')
-rw-r--r-- | src/opt.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -947,8 +947,12 @@ static struct bfs_expr *visit_shallow(struct bfs_opt *opt, struct bfs_expr *expr expr = general(opt, expr, visitor); } + if (!expr) { + return NULL; + } + visit_fn *specific = look_up_visitor(expr, visitor->table); - if (expr && specific) { + if (specific) { expr = specific(opt, expr, visitor); } |