Fixed an off-by-one array-out-of-bounds bug.

Reviewed-by: Lasse Holmstedt
This commit is contained in:
Erik Verbruggen
2011-04-11 09:56:26 +02:00
parent 752606e48d
commit 483875f2be

View File

@@ -169,10 +169,10 @@ void FindUsages::reportResult(unsigned tokenIndex)
getTokenStartPosition(tokenIndex, &line, &col);
QString lineText;
QList<QByteArray> lines = _originalSource.split('\n');
if (lines.size() < ((int) line - 1))
lineText = matchingLine(tk);
else
if (((int) line - 1) < lines.size())
lineText = QString::fromUtf8(lines.at(line - 1));
else
lineText = matchingLine(tk);
if (col)
--col; // adjust the column position.