From e675fb3cc18117bee065719afd390995e8494e87 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 12 May 2011 18:33:29 +0100 Subject: [PATCH] Fix crash with negative lava ctype E.g. "set type prti lava" --- src/powder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/powder.c b/src/powder.c index 63527b289..af333bb33 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1396,8 +1396,11 @@ void update_particles_i(pixel *vid, int start, int inc) lx = parts[i].x; ly = parts[i].y; t = parts[i].type; - if (t>=PT_NUM) + if (t<0 || t>=PT_NUM) + { + kill_part(i); continue; + } //printf("parts[%d].type: %d\n", i, parts[i].type); if (parts[i].life>0 && (ptypes[t].properties&PROP_LIFE_DEC)) @@ -1599,7 +1602,7 @@ void update_particles_i(pixel *vid, int start, int inc) else t = PT_DSTW; } else if (t==PT_LAVA) { - if (parts[i].ctype && parts[i].ctype0 && parts[i].ctype=ptransitions[PT_BMTL].thv) s = 0; else if (ptransitions[parts[i].ctype].tht==PT_LAVA) { if (pt>=ptransitions[parts[i].ctype].thv) s = 0;