Beautifier: Fix possible endless loop

Change-Id: Ib2f98c2d761ea9abfd6a42ec30cf8318ee7bd575
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@digia.com>