Browse Source

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

--HG--
branch : minor
Bart van Strien 8 years ago
parent
commit
7dfbfbda79
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/graphics/wrap_ParticleSystem.cpp

+ 4 - 0
src/modules/graphics/wrap_ParticleSystem.cpp

@@ -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;
 }