Fix segfault

Fixes #7360

`begin` and `end` must be called on the very same container, but the container returned by `player::active_items` is a different object each time that function gets called. So the iterator ends up being compared to the end-iterator of another container. This evaluates to false and the loop continues despite an invalid iterator.