aboutsummaryrefslogtreecommitdiff
path: root/collections/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/map/map.c')
-rw-r--r--collections/map/map.c3
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);
}