Fix segfaults when running under -Dx.
Marcus Holland-Moritz [Sat, 28 Feb 2004 15:04:41 +0000 (15:04 +0000)]
p4raw-id: //depot/perl@22406

dump.c

diff --git a/dump.c b/dump.c
index 69fa933..049f948 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -454,7 +454,7 @@ sequence(pTHX_ register OP *o)
        case OP_COND_EXPR:
        case OP_RANGE:
            hv_store(Sequence, key, len, newSVuv(++seq), 0);
-           for (l = cLOGOPo->op_other; l->op_type == OP_NULL; l = l->op_next)
+           for (l = cLOGOPo->op_other; l && l->op_type == OP_NULL; l = l->op_next)
                ;
            sequence(aTHX_ l);
            break;
@@ -462,13 +462,13 @@ sequence(pTHX_ register OP *o)
        case OP_ENTERLOOP:
        case OP_ENTERITER:
            hv_store(Sequence, key, len, newSVuv(++seq), 0);
-           for (l = cLOOPo->op_redoop; l->op_type == OP_NULL; l = l->op_next)
+           for (l = cLOOPo->op_redoop; l && l->op_type == OP_NULL; l = l->op_next)
                ;
            sequence(aTHX_ l);
-           for (l = cLOOPo->op_nextop; l->op_type == OP_NULL; l = l->op_next)
+           for (l = cLOOPo->op_nextop; l && l->op_type == OP_NULL; l = l->op_next)
                ;
            sequence(aTHX_ l);
-           for (l = cLOOPo->op_lastop; l->op_type == OP_NULL; l = l->op_next)
+           for (l = cLOOPo->op_lastop; l && l->op_type == OP_NULL; l = l->op_next)
                ;
            sequence(aTHX_ l);
            break;
@@ -477,7 +477,7 @@ sequence(pTHX_ register OP *o)
        case OP_MATCH:
        case OP_SUBST:
            hv_store(Sequence, key, len, newSVuv(++seq), 0);
-           for (l = cPMOPo->op_pmreplstart; l->op_type == OP_NULL; l = l->op_next)
+           for (l = cPMOPo->op_pmreplstart; l && l->op_type == OP_NULL; l = l->op_next)
                ;
            sequence(aTHX_ l);
            break;