This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[ID 20010912.007] substr reference core dump
authorme-01@ton.iguana.be <me-01@ton.iguana.be>
Wed, 12 Sep 2001 14:11:16 +0000 (14:11 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 12 Sep 2001 13:14:59 +0000 (13:14 +0000)
Message-Id: <20010912141116.6058.qmail@quasar.home.lunix>

p4raw-id: //depot/perl@12005

mg.c

diff --git a/mg.c b/mg.c
index 9def37f..3de4420 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1506,7 +1506,7 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
        sv_insert(lsv, lvoff, lvlen, tmps, len);
        SvUTF8_on(lsv);
     }
-    else if (SvUTF8(lsv)) {
+    else if (lsv && SvUTF8(lsv)) {
        sv_pos_u2b(lsv, &lvoff, &lvlen);
        tmps = (char*)bytes_to_utf8((U8*)tmps, &len);
        sv_insert(lsv, lvoff, lvlen, tmps, len);