SciCompMod / memilio

Modular spatio-temporal models for epidemic and pandemic simulations
https://scicompmod.github.io/memilio/
Apache License 2.0
51 stars 15 forks source link

Dynamic NPIs causes max_value of size_t loop if damping_expr.get_dampings().size() = 0 #997

Closed HenrZu closed 2 months ago

HenrZu commented 2 months ago

Bug description

https://github.com/SciCompMod/memilio/blob/f5e415a079135b1a48c120b7ac6999075df6146d/cpp/memilio/epidemiology/dynamic_npis.h#L323

If damping_expr.get_dampings().size() == 0, then damping_expr.get_dampings().size() - 1 is a big problem, because of the size_t. Either we check beforehand that the size is greater than 0 or we change the dtype.

Version

Linux

To reproduce

just run an example where the condition above is fulfilled.

Relevant log output

No response

Add any relevant information, e.g. used compiler, screenshots.

No response

Checklist