Don't call GvCV on something that's not a GV.
Florian Ragwitz [Sat, 14 Feb 2009 02:59:10 +0000 (02:59 +0000)]
MOP.xs

diff --git a/MOP.xs b/MOP.xs
index 71e2c7d..4fbf38f 100644 (file)
--- a/MOP.xs
+++ b/MOP.xs
@@ -354,7 +354,7 @@ is_class_loaded(klass=&PL_sv_undef)
         HV *stash;
         char *key;
         I32 keylen;
-        GV *gv;
+        SV *gv;
     PPCODE:
         if (!SvPOK(klass) || !SvCUR(klass)) {
             XSRETURN_NO;
@@ -390,7 +390,7 @@ is_class_loaded(klass=&PL_sv_undef)
         }
 
         (void)hv_iterinit(stash);
-        while ((gv = (GV *)hv_iternextsv(stash, &key, &keylen))) {
+        while ((gv = hv_iternextsv(stash, &key, &keylen))) {
             if (keylen <= 0) {
                 continue;
             }
@@ -399,7 +399,7 @@ is_class_loaded(klass=&PL_sv_undef)
                 continue;
             }
 
-            if (GvCV(gv)) {
+            if (!isGV(gv) || GvCV(gv)) {
                 XSRETURN_YES;
             }
         }