when checking @ISA to see if a class is loaded, make sure it actually has values...
[gitmo/Class-MOP.git] / xs / MOP.xs
index 60c006c..cf07b55 100644 (file)
--- a/xs/MOP.xs
+++ b/xs/MOP.xs
@@ -8,10 +8,18 @@ static bool
 find_method (const char *key, STRLEN keylen, SV *val, void *ud)
 {
     bool *found_method = (bool *)ud;
+    PERL_UNUSED_ARG(key);
+    PERL_UNUSED_ARG(keylen);
+    PERL_UNUSED_ARG(val);
     *found_method = TRUE;
     return FALSE;
 }
 
+EXTERN_C XS(boot_Class__MOP__Package);
+EXTERN_C XS(boot_Class__MOP__Class);
+EXTERN_C XS(boot_Class__MOP__Attribute);
+EXTERN_C XS(boot_Class__MOP__Method);
+
 MODULE = Class::MOP   PACKAGE = Class::MOP
 
 PROTOTYPES: DISABLE
@@ -81,7 +89,7 @@ is_class_loaded(klass=&PL_sv_undef)
 
         if (hv_exists_ent (stash, KEY_FOR(ISA), HASH_FOR(ISA))) {
             HE *isa = hv_fetch_ent(stash, KEY_FOR(ISA), 0, HASH_FOR(ISA));
-            if (isa && HeVAL(isa) && GvAV(HeVAL(isa))) {
+            if (isa && HeVAL(isa) && GvAV(HeVAL(isa)) && av_len(GvAV(HeVAL(isa))) != -1) {
                 XSRETURN_YES;
             }
         }