From: Jesse Luehrs Date: Thu, 29 Mar 2012 07:50:35 +0000 (-0500) Subject: sometimes the stash doesn't exist at all X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fattic%2Fignore-duplicate-role-application;p=gitmo%2FMoose.git sometimes the stash doesn't exist at all for instance, when it has been deleted --- diff --git a/mop.c b/mop.c index 6cb77f0..23ca98a 100644 --- a/mop.c +++ b/mop.c @@ -95,12 +95,14 @@ mop_get_code_info (SV *coderef, char **pkg, char **name) */ if ( isGV_with_GP(CvGV(coderef)) ) { - GV *gv = CvGV(coderef); - *pkg = HvNAME( GvSTASH(gv) ? GvSTASH(gv) : CvSTASH(coderef) ); - *name = GvNAME( CvGV(coderef) ); + GV *gv = CvGV(coderef); + HV *stash = GvSTASH(gv) ? GvSTASH(gv) : CvSTASH(coderef); + + *pkg = stash ? HvNAME(stash) : "__UNKNOWN__"; + *name = GvNAME( CvGV(coderef) ); } else { - *pkg = "__UNKNOWN__"; - *name = "__ANON__"; + *pkg = "__UNKNOWN__"; + *name = "__ANON__"; } return 1;