From: Abhijit Menon-Sen Date: Sat, 3 Nov 2001 03:45:19 +0000 (+0000) Subject: Ugly bandaid to stop C from segfaulting (remember to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c86bf3738f7c11cf104e47bcf1593b2856268b80;p=p5sagit%2Fp5-mst-13.2.git Ugly bandaid to stop C from segfaulting (remember to remove this later). Based on a patch from Robert Spier in <15330.61459.14452.795263@rls.cx>. p4raw-id: //depot/perl@12827 --- diff --git a/sv.c b/sv.c index 2da1291..74c3450 100644 --- a/sv.c +++ b/sv.c @@ -3004,8 +3004,15 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) default: s = "UNKNOWN"; break; } tsv = NEWSV(0,0); - if (SvOBJECT(sv)) - Perl_sv_setpvf(aTHX_ tsv, "%s=%s", HvNAME(SvSTASH(sv)), s); + if (SvOBJECT(sv)) { + HV *svs = SvSTASH(sv); + Perl_sv_setpvf( + aTHX_ tsv, "%s=%s", + /* [20011101.072] This bandaid for C + should eventually be removed. AMS 20011103 */ + (svs ? HvNAME(svs) : ""), s + ); + } else sv_setpv(tsv, s); Perl_sv_catpvf(aTHX_ tsv, "(0x%"UVxf")", PTR2UV(sv)); @@ -6942,8 +6949,12 @@ Returns a string describing what the SV is a reference to. char * Perl_sv_reftype(pTHX_ SV *sv, int ob) { - if (ob && SvOBJECT(sv)) - return HvNAME(SvSTASH(sv)); + if (ob && SvOBJECT(sv)) { + HV *svs = SvSTASH(sv); + /* [20011101.072] This bandaid for C should eventually + be removed. AMS 20011103 */ + return (svs ? HvNAME(svs) : ""); + } else { switch (SvTYPE(sv)) { case SVt_NULL: