LPS-49297 Preventing the use of an iterator that can be invalidated insi...

...de the loop