瀏覽代碼

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

--HG--
branch : minor
Bart van Strien 8 年之前
父節點
當前提交
7dfbfbda79
共有 1 個文件被更改,包括 4 次插入0 次删除
  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;
 }