Fix invalid derefence
Fix invalid derefence

Summary: Do not dereference an iterator before checking whether it is the end of the container.

Reviewed By: amnn

Differential Revision: D19689135

fbshipit-source-id: 2ac73a9572004a6e15a7c0b66ef9261b67f60689

facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex