This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix crash when lex subs are used for overload
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 7e3058d..e4d6aca 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -2553,7 +2553,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