TINSEL: Reorder loop condition to fix out-of-bounds access

This should fix CID 1003943 and CID 1003944.