mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-23 00:12:51 +02:00
TPT: fix crash, spark reset set type without checking if it was a valid number
This commit is contained in:
@@ -1128,8 +1128,13 @@ int luatpt_reset_spark(lua_State* l)
|
||||
{
|
||||
if (luacon_sim->parts[i].type==PT_SPRK)
|
||||
{
|
||||
luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
|
||||
luacon_sim->parts[i].life = 4;
|
||||
if (luacon_sim->parts[i].ctype >= 0 && luacon_sim->parts[i].ctype < PT_NUM)
|
||||
{
|
||||
luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
|
||||
luacon_sim->parts[i].life = 0;
|
||||
}
|
||||
else
|
||||
luacon_sim->kill_part(i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user