Fixed infinite loop described in INT-3453.
Merge pull request #1182 from JohnA2/INT-3453

Fixed infinite loop described in INT-3453.