Avoid creating GV with NULL name when vivifying nameless scalars.
Nick Ing-Simmons [Sun, 24 Oct 1999 20:54:06 +0000 (20:54 +0000)]
(Fix/workround for [ID19991024.001])

p4raw-id: //depot/perl@4444

pp.c

diff --git a/pp.c b/pp.c
index 8f4a156..43a2e7c 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -245,8 +245,14 @@ PP(pp_rv2gv)
                    STRLEN len = 0;
                    char *name = "";
                    if (cUNOP->op_first->op_type == OP_PADSV) {
-                       SV *padname = *av_fetch(PL_comppad_name, cUNOP->op_first->op_targ, 4);
-                       name = SvPV(padname,len);                                                    
+                       SV **namep = av_fetch(PL_comppad_name, cUNOP->op_first->op_targ, 4);
+                       if (namep && *namep) {
+                           name = SvPV(*namep,len);
+                           if (!name) {
+                               name = "";
+                               len  = 0;
+                           }
+                       }
                    }
                    gv_init(gv, PL_curcop->cop_stash, name, len, 0);
                    sv_upgrade(sv, SVt_RV);