not break from the loop, only from the switch. Make it break from the loop to avoid a NULL pointer dereference.