From 7dfbfbda796c073d1019ade6a4fac176038e8958 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 9 Sep 2017 13:23:49 +0200 Subject: [PATCH] Error if ParticleSystem's particle lifetime is set to a negative value (resolves #1339) --HG-- branch : minor --- src/modules/graphics/wrap_ParticleSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/graphics/wrap_ParticleSystem.cpp b/src/modules/graphics/wrap_ParticleSystem.cpp index 2be508c1b..8724a387d 100644 --- a/src/modules/graphics/wrap_ParticleSystem.cpp +++ b/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; }