diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-07-08 23:14:07 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-07-08 23:14:07 -0400 |
commit | d84bce07b9051ce140203ad9fa5af961361ffb7a (patch) | |
tree | b7e2beba30997971ffc2d7749376c323b38d42e2 | |
parent | e4a56e626030b728a7dcada8e84a77d1da3b00ae (diff) |
Fix return on null tree for map balance factor
-rw-r--r-- | collections/map/map.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c index cbb3b79..a1c7798 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -34,6 +34,9 @@ struct map_node *root; int map_bal_factor(root) struct map_node *root; { + if (!root) + return 0; + return map_height(root->right) - map_height(root->left); } |