# HG changeset patch
# User Mario de Sousa <msousa@fe.up.pt>
# Date 1339517529 -3600
# Node ID be7330d9b65c15e10dd57e0d4c17d1a38d4d2c4a
# Parent  f95d6561d4399325ac885e561cf3bb309aefdc84
Remove potential access to NULL pointer.

diff -r f95d6561d439 -r be7330d9b65c stage3/array_range_check.cc
--- a/stage3/array_range_check.cc	Tue Jun 12 17:07:40 2012 +0100
+++ b/stage3/array_range_check.cc	Tue Jun 12 17:12:09 2012 +0100
@@ -106,6 +106,9 @@
   array_dimension_iterator_c array_dimension_iterator(var_decl);
   for (int i =  0; i < l->n; i++) {
     subrange_c *dimension = array_dimension_iterator.next();
+    /* mismatch between number of indexes/subscripts. This error will be caught in check_dimension_count() so we ignore it. */
+    if (NULL == dimension) 
+      return;
     
     if ( VALID_CVALUE( int64, l->elements[i]) && VALID_CVALUE( int64, dimension->lower_limit))
       if ( GET_CVALUE( int64, l->elements[i])   <  GET_CVALUE( int64, dimension->lower_limit))