HvNAME_get can return NULL
Yuval Kogman [Fri, 22 Aug 2008 08:18:26 +0000 (08:18 +0000)]
Moose.xs

index 84456b3..3f1ae79 100644 (file)
--- a/Moose.xs
+++ b/Moose.xs
@@ -462,8 +462,10 @@ STATIC bool check_sv_type (TC type, SV *sv) {
                 SV *rv = SvRV(sv);
                 if ( SvOBJECT(rv) ) {
                     char *name = HvNAME_get(SvSTASH(SvRV(sv)));
-                    bool is_regexp = strEQ("Regexp", name);
-                    return ( (type == RegexpRef) ^ !is_regexp );
+                    if ( name ) {
+                        bool is_regexp = strEQ("Regexp", name);
+                        return ( (type == RegexpRef) ^ !is_regexp );
+                    }
                 }
             }
             return 0;