Do not read array before checking the bounds

Fixes coverity issue 23377
This commit is contained in:
Jean-Marc Lasgouttes 2015-02-20 16:51:20 +01:00
parent 2694fde47d
commit 143c136a7f

View File

@ -176,7 +176,7 @@ QString getBlock(char_type c)
// guessing was wrong so far. do a real search.
int i = 0;
while (c > unicode_blocks[i].end && i < no_blocks)
while (i < no_blocks && c > unicode_blocks[i].end)
++i;
if (i == no_blocks)
return QString();