summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/gv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/gv.c')
-rw-r--r--gnu/usr.bin/perl/gv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/usr.bin/perl/gv.c b/gnu/usr.bin/perl/gv.c
index e402f6bf72f..ce6847842c7 100644
--- a/gnu/usr.bin/perl/gv.c
+++ b/gnu/usr.bin/perl/gv.c
@@ -1202,7 +1202,7 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags)
* use that, but for lack of anything better we will use the sub's
* original package to look up $AUTOLOAD.
*/
- varstash = GvSTASH(CvGV(cv));
+ varstash = CvNAMED(cv) ? CvSTASH(cv) : GvSTASH(CvGV(cv));
vargv = *(GV**)hv_fetch(varstash, S_autoload, S_autolen, TRUE);
ENTER;
@@ -2544,7 +2544,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool destructing)
numifying instead of C's "+0". */
gv = Perl_gv_fetchmeth_pvn(aTHX_ stash, cooky, l, -1, 0);
cv = 0;
- if (gv && (cv = GvCV(gv))) {
+ if (gv && (cv = GvCV(gv)) && CvGV(cv)) {
if(GvNAMELEN(CvGV(cv)) == 3 && strEQ(GvNAME(CvGV(cv)), "nil")){
const char * const hvname = HvNAME_get(GvSTASH(CvGV(cv)));
if (hvname && HEK_LEN(HvNAME_HEK(GvSTASH(CvGV(cv)))) == 8