From d84bce07b9051ce140203ad9fa5af961361ffb7a Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Wed, 8 Jul 2020 23:14:07 -0400 Subject: Fix return on null tree for map balance factor --- collections/map/map.c | 3 +++ 1 file changed, 3 insertions(+) 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); } -- cgit v1.1