Fix exiting loop after hitting maximum identities.

Checking a condition, then continuing as the last statement in a loop wouldn't do anything useful.