Don't fail if a coderef's GV doesn't have a stash.
Florian Ragwitz [Wed, 15 Jul 2009 22:24:36 +0000 (00:24 +0200)]
mop.c

diff --git a/mop.c b/mop.c
index 0fc1be1..dfb178b 100644 (file)
--- a/mop.c
+++ b/mop.c
@@ -96,7 +96,8 @@ mop_get_code_info (SV *coderef, char **pkg, char **name)
 #ifdef isGV_with_GP
     if ( isGV_with_GP(CvGV(coderef)) ) {
 #endif
-        *pkg     = HvNAME( GvSTASH(CvGV(coderef)) );
+        GV *gv   = CvGV(coderef);
+        *pkg     = HvNAME( GvSTASH(gv) ? GvSTASH(gv) : CvSTASH(coderef) );
         *name    = GvNAME( CvGV(coderef) );
 #ifdef isGV_with_GP
     } else {