This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pad.c:cv_clone: add assertions
[perl5.git] / pad.c
diff --git a/pad.c b/pad.c
index 1e796e7..8deae8e 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -2010,6 +2010,7 @@ Perl_cv_clone(pTHX_ CV *proto)
     outpad = CvPADLIST(outside)
        ? AvARRAY(AvARRAY(CvPADLIST(outside))[depth])
        : NULL;
+    assert(outpad || SvTYPE(cv) == SVt_PVFM);
 
     for (ix = fpad; ix > 0; ix--) {
        SV* const namesv = (ix <= fname) ? pname[ix] : NULL;
@@ -2022,6 +2023,7 @@ Perl_cv_clone(pTHX_ CV *proto)
                if (!outpad || !(sv = outpad[PARENT_PAD_INDEX(namesv)])
                 || (  SvPADSTALE(sv) && !SvPAD_STATE(namesv)
                    && !CvDEPTH(outside))  ) {
+                   assert(SvTYPE(cv) == SVt_PVFM);
                    Perl_ck_warner(aTHX_ packWARN(WARN_CLOSURE),
                                   "Variable \"%"SVf"\" is not available", namesv);
                    sv = NULL;