App: Coverity fixes
This commit is contained in:
committed by
Benjamin Nauck
parent
eedb743959
commit
09cdcee1bb
@@ -75,14 +75,17 @@ QString ExpressionTokenizer::perform(const QString& prefix, int pos)
|
||||
// Pop those trailing tokens depending on the given position, which may be
|
||||
// in the middle of a token, and we shall include that token.
|
||||
for (auto it = tokens.begin(); it != tokens.end(); ++it) {
|
||||
if (std::get<1>(*it) >= pos) {
|
||||
int tokenType = std::get<0>(*it);
|
||||
int location = std::get<1>(*it);
|
||||
int tokenLength = static_cast<int> (std::get<2>(*it).size());
|
||||
if (location >= pos) {
|
||||
// Include the immediately followed '.' or '#', because we'll be
|
||||
// inserting these separators too, in ExpressionCompleteModel::pathFromIndex()
|
||||
if (it != tokens.begin() && std::get<0>(*it) != '.' && std::get<0>(*it) != '#') {
|
||||
if (it != tokens.begin() && tokenType != '.' && tokenType != '#') {
|
||||
it = it - 1;
|
||||
}
|
||||
tokens.resize(it - tokens.begin() + 1);
|
||||
prefixEnd = start + std::get<1>(*it) + (int)std::get<2>(*it).size();
|
||||
tokens.resize(it - tokens.begin() + 1); // Invalidates it, but we already calculated tokenLength
|
||||
prefixEnd = start + location + tokenLength;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user