Thanks, but is still a bug IMHO. Deleting bodies should also delete the interactions. I'm reopening.
The presence of a pointer to a deleted interaction can be tolerated, but I don't understand how O.bodies.erase(100) can leave interactions with bodyId=100 in the state i.isReal=true. This is not supposed to happen.
Your fix was correct Anton, I'm sorry. The problem is that the function does not use body iterators and really assume that there is no empty slots in O.bodies. Can you please re-apply?
Fixed in f22aab98. The problem was in bodyNumInteract ionsHistogram, it did not check, whether the body exists.
Anton