[svn:parrot] r36439 - trunk/src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun Feb 8 12:22:25 UTC 2009


Author: NotFound
Date: Sun Feb  8 12:22:24 2009
New Revision: 36439
URL: https://trac.parrot.org/parrot/changeset/36439

Log:
[core] avoid dereferencing a pointer before checking it for nullness

Modified:
   trunk/src/pmc.c

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c	Sun Feb  8 11:53:20 2009	(r36438)
+++ trunk/src/pmc.c	Sun Feb  8 12:22:24 2009	(r36439)
@@ -589,14 +589,15 @@
         PMC * const item           =
             (PMC *)VTABLE_get_pointer_keyed_str(interp, classname_hash, name);
 
-        /* nested namespace with same name */
-        if (item->vtable->base_type == enum_class_NameSpace)
-            return enum_type_undef;
-
-        if (!PMC_IS_NULL(item))
-            return VTABLE_get_integer(interp, item);
-
-        return Parrot_get_datatype_enum(interp, name);
+        if (!PMC_IS_NULL(item)) {
+            /* nested namespace with same name */
+            if (item->vtable->base_type == enum_class_NameSpace)
+                return enum_type_undef;
+            else
+                return VTABLE_get_integer(interp, item);
+        }
+	else
+            return Parrot_get_datatype_enum(interp, name);
     }
 }
 


More information about the parrot-commits mailing list