summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2017-08-31 10:05:54 +1000
committerTony Cook <tony@develop-help.com>2017-08-31 10:21:05 +1000
commit745e740c825d415f535852b90516127e64c24905 (patch)
treee885978953fc413d96f82acb216d8fb2ccdc672f /mg.c
parent1f52e4c40f4c8f591df6917a490f208d081adb9e (diff)
downloadperl-745e740c825d415f535852b90516127e64c24905.tar.gz
(perl #128263) handle PL_last_in_gv being &PL_sv_undef
rv2gv will return &PL_sv_undef when it can't get a GV, previously this could cause an assertion failure in mg.c My original fix for this changed each op that deals with GVs for I/O to set PL_last_in_gv to NULL if there was no io object in the GV, but this changes other behaviour as noted by FatherC. Also partly reverts 84ee769f, which unnecessarily did the same for readline(), so now we're consistent.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index e0d1215281..971fceed2b 100644
--- a/mg.c
+++ b/mg.c
@@ -1007,7 +1007,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
break;
case '\014': /* ^LAST_FH */
if (strEQ(remaining, "AST_FH")) {
- if (PL_last_in_gv) {
+ if (PL_last_in_gv && (SV*)PL_last_in_gv != &PL_sv_undef) {
assert(isGV_with_GP(PL_last_in_gv));
SV_CHECK_THINKFIRST_COW_DROP(sv);
prepare_SV_for_RV(sv);