Error if ParticleSystem's particle lifetime is set to a negative value (resolves #1339)

--HG--
branch : minor
This commit is contained in:
Bart van Strien
2017-09-09 13:23:49 +02:00
parent bf67d7ad0e
commit 7dfbfbda79
@@ -151,6 +151,10 @@ int w_ParticleSystem_setParticleLifetime(lua_State *L)
ParticleSystem *t = luax_checkparticlesystem(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
float arg2 = (float)luaL_optnumber(L, 3, arg1);
if (arg1 < 0.0f || arg2 < 0.0f)
return luaL_error(L, "Invalid particle lifetime (must be >= 0)");
t->setParticleLifetime(arg1, arg2);
return 0;
}