1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 00:55:20 +02:00

Sanitize invalid particle spawner time (#15465)

This commit is contained in:
Lars Müller
2024-11-24 19:23:53 +01:00
committed by GitHub
parent 11b19cd126
commit b77ad82fb9
3 changed files with 8 additions and 0 deletions

View File

@@ -270,6 +270,7 @@ ParticleSpawner::ParticleSpawner(
}
size_t max_particles = 0; // maximum number of particles likely to be visible at any given time
assert(p.time >= 0);
if (p.time != 0) {
auto maxGenerations = p.time / std::min(p.exptime.start.min, p.exptime.end.min);
max_particles = p.amount / maxGenerations;