mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-09 13:24:01 +00:00
Fix unsafe entity iteration.
It was possible to crash the game by creating many entities in a script callback that iterates over entities, for example.
This commit is contained in:
parent
748dc6cd9d
commit
51ee827d98
1 changed files with 2 additions and 1 deletions
|
@ -166,7 +166,8 @@ enum AquariaActions
|
|||
typedef std::list<Entity*> EntityList;
|
||||
typedef std::vector<Entity*> EntityContainer;
|
||||
|
||||
#define FOR_ENTITIES(i) for (Entity **i = &dsq->entities[0]; *i != 0; i++)
|
||||
// last entry is always NULL. added if is a little hack to ensure the scope of the iterator variable
|
||||
#define FOR_ENTITIES(i) for (size_t i##_i = 0; dsq->entities[i##_i] != 0; ++i##_i) if (Entity **i = &dsq->entities[i##_i])
|
||||
|
||||
|
||||
enum MenuPage
|
||||
|
|
Loading…
Add table
Reference in a new issue