Dodge a NULL pointer dereference in cleanup of Class::DBI
Jarkko Hietaniemi [Tue, 30 Apr 2002 12:32:27 +0000 (12:32 +0000)]
0.86's t/04-lazy.t, caught by Tatsuhiko Miyagawa.

p4raw-id: //depot/perl@16277

util.c

diff --git a/util.c b/util.c
index 1c40d46..a5b9c9b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1109,13 +1109,15 @@ 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))) {
+       if (GvIO(PL_last_in_gv) && GvGP(PL_last_in_gv) &&
+           IoLINES(GvIOp(PL_last_in_gv))) {
            bool line_mode = (RsSIMPLE(PL_rs) &&
                              SvCUR(PL_rs) == 1 && *SvPVX(PL_rs) == '\n');
            Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,
-                     PL_last_in_gv == PL_argvgv ? "" : GvNAME(PL_last_in_gv),
-                     line_mode ? "line" : "chunk",
-                     (IV)IoLINES(GvIOp(PL_last_in_gv)));
+                          PL_last_in_gv == PL_argvgv ?
+                          "" : GvNAME(PL_last_in_gv),
+                          line_mode ? "line" : "chunk",
+                          (IV)IoLINES(GvIOp(PL_last_in_gv)));
        }
 #ifdef USE_5005THREADS
        if (thr->tid)