By swapping the order of pushes onto the save stack for
[p5sagit/p5-mst-13.2.git] / mg.c
diff --git a/mg.c b/mg.c
index 82f63c0..830e039 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1053,7 +1053,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
     if (!len) {
        SV ** const valp = hv_fetch(GvHVn(PL_envgv), ptr, klen, FALSE);
        if (valp)
-           s = SvPV_const(*valp, len);
+           s = SvOK(*valp) ? SvPV_const(*valp, len) : "";
     }
 #endif