summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/util.c b/util.c
index 3c5518339e..c2870ea3fa 100644
--- a/util.c
+++ b/util.c
@@ -1154,7 +1154,10 @@ Perl_vmess(pTHX_ const char *pat, va_list *args)
if (CopLINE(cop))
Perl_sv_catpvf(aTHX_ sv, " at %s line %"IVdf,
OutCopFILE(cop), (IV)CopLINE(cop));
- if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {
+ /* Seems that GvIO() can be untrustworthy during global destruction. */
+ if (GvIO(PL_last_in_gv) && (SvTYPE(GvIOp(PL_last_in_gv)) == SVt_PVIO)
+ && IoLINES(GvIOp(PL_last_in_gv)))
+ {
const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,