isl_dim_get_dim_id: complain if dim has no id
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 11 Aug 2011 15:17:49 +0000 (17:17 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 12 Aug 2011 09:38:15 +0000 (11:38 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_dim.c

index b469808..93f12e8 100644 (file)
--- a/isl_dim.c
+++ b/isl_dim.c
@@ -378,6 +378,11 @@ int isl_dim_has_dim_id(__isl_keep isl_dim *dim,
 __isl_give isl_id *isl_dim_get_dim_id(__isl_keep isl_dim *dim,
        enum isl_dim_type type, unsigned pos)
 {
+       if (!dim)
+               return NULL;
+       if (!get_id(dim, type, pos))
+               isl_die(dim->ctx, isl_error_invalid,
+                       "dim has no id", return NULL);
        return isl_id_copy(get_id(dim, type, pos));
 }