isl_basic_map_total_dim: avoid NULL pointer dereference
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 25 Jun 2010 15:15:57 +0000 (17:15 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 26 Jun 2010 15:37:38 +0000 (17:37 +0200)
isl_map.c

index 11cfb89..ff46a29 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -207,7 +207,7 @@ unsigned isl_basic_map_n_div(const struct isl_basic_map *bmap)
 
 unsigned isl_basic_map_total_dim(const struct isl_basic_map *bmap)
 {
-       return isl_dim_total(bmap->dim) + bmap->n_div;
+       return bmap ? isl_dim_total(bmap->dim) + bmap->n_div : 0;
 }
 
 unsigned isl_map_n_in(const struct isl_map *map)