瀏覽代碼

Merge pull request #8778 from honix/master

Particles potential crash fix 2
Rémi Verschelde 8 年之前
父節點
當前提交
d801ff2b3d
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      scene/3d/particles.cpp

+ 2 - 0
scene/3d/particles.cpp

@@ -48,11 +48,13 @@ void Particles::set_emitting(bool p_emitting) {
 
 void Particles::set_amount(int p_amount) {
 
+	ERR_FAIL_COND(p_amount < 1);
 	amount = p_amount;
 	VS::get_singleton()->particles_set_amount(particles, amount);
 }
 void Particles::set_lifetime(float p_lifetime) {
 
+	ERR_FAIL_COND(p_lifetime <= 0);
 	lifetime = p_lifetime;
 	VS::get_singleton()->particles_set_lifetime(particles, lifetime);
 }