* symtab.c (lookup_language_this): End loop if block is NULL.
authorTom Tromey <tromey@redhat.com>
Mon, 20 Jun 2011 17:53:33 +0000 (17:53 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 20 Jun 2011 17:53:33 +0000 (17:53 +0000)
gdb/ChangeLog
gdb/symtab.c

index 70ae97614d343cc39805730c0ff4f2b566528448..954fb5317a25fea8c510fa59267dfdc0e4de53fb 100644 (file)
@@ -1,3 +1,7 @@
+2011-06-20  Tom Tromey  <tromey@redhat.com>
+
+       * symtab.c (lookup_language_this): End loop if block is NULL.
+
 2011-06-17  Tom Tromey  <tromey@redhat.com>
 
        * valops.c (value_of_this): Use lookup_language_this.
index d627636ae1a601e957162754af3495caab590039..13234f236df9ad332627976b84b012809e4dda48 100644 (file)
@@ -1100,7 +1100,7 @@ lookup_language_this (const struct language_defn *lang,
   if (lang->la_name_of_this == NULL || block == NULL)
     return NULL;
 
-  while (1)
+  while (block)
     {
       struct symbol *sym;
 
@@ -1108,9 +1108,11 @@ lookup_language_this (const struct language_defn *lang,
       if (sym != NULL)
        return sym;
       if (BLOCK_FUNCTION (block))
-       return NULL;
+       break;
       block = BLOCK_SUPERBLOCK (block);
     }
+
+  return NULL;
 }
 
 /* Behave like lookup_symbol except that NAME is the natural name