med-material / Whack_A_Mole_VR

Whack-A-Mole in VR
MIT License
3 stars 15 forks source link

PatternPlayer: Avoid removal doing traversal #273

Closed mrvilix06 closed 11 months ago

mrvilix06 commented 11 months ago

This pull request addresses an issue with the current implementation where items are being removed from a collection while iterating over it.

Iterating over a collection while removing items from it is not a recommended practice, as it can lead to unexpected behavior and bugs.

So we split the existing loop into two separate loops: One for iterating over the collection and identifying items to be removed. Another for actually removing those items from the collection.