Fix segfault when there are no unused particles before parts_lastActiveIndex
This commit is contained in:
parent
3ed6a44a24
commit
806e1933a2
@ -2447,8 +2447,16 @@ void update_particles(pixel *vid)//doesn't update the particles themselves, but
|
|||||||
lastPartUnused = i;
|
lastPartUnused = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lastPartUnused==-1)
|
||||||
|
{
|
||||||
|
if (parts_lastActiveIndex>=NPART-1) pfree = -1;
|
||||||
|
else pfree = parts_lastActiveIndex+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (parts_lastActiveIndex>=NPART-1) parts[lastPartUnused].life = -1;
|
if (parts_lastActiveIndex>=NPART-1) parts[lastPartUnused].life = -1;
|
||||||
else parts[lastPartUnused].life = parts_lastActiveIndex+1;
|
else parts[lastPartUnused].life = parts_lastActiveIndex+1;
|
||||||
|
}
|
||||||
parts_lastActiveIndex = lastPartUsed;
|
parts_lastActiveIndex = lastPartUsed;
|
||||||
for (y=0; y<YRES/CELL; y++)
|
for (y=0; y<YRES/CELL; y++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user