Coverity: Argument cannot be negative (actually a bug by using the wrong index variable)
This commit is contained in:
@@ -241,12 +241,10 @@ void DocumentRecovery::accept()
|
||||
if (!d->recovered) {
|
||||
|
||||
WaitCursor wc;
|
||||
int index = -1;
|
||||
int index = 0;
|
||||
std::vector<int> indices;
|
||||
std::vector<std::string> filenames, paths, labels, errs;
|
||||
for (auto &info : d->recoveryInfo) {
|
||||
++index;
|
||||
|
||||
QString errorInfo;
|
||||
QTreeWidgetItem* item = d_ptr->ui.treeWidget->topLevelItem(index);
|
||||
|
||||
@@ -260,6 +258,7 @@ void DocumentRecovery::accept()
|
||||
filenames.emplace_back(info.fileName.toUtf8().constData());
|
||||
labels.emplace_back(info.label.toUtf8().constData());
|
||||
indices.push_back(index);
|
||||
++index;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
errorInfo = QString::fromLatin1(e.what());
|
||||
@@ -294,7 +293,7 @@ void DocumentRecovery::accept()
|
||||
|
||||
if (item) {
|
||||
item->setText(1, tr("Failed to recover"));
|
||||
item->setToolTip(1, QString::fromUtf8(errs[index].c_str()));
|
||||
item->setToolTip(1, QString::fromUtf8(errs[i].c_str()));
|
||||
item->setForeground(1, QColor(170,0,0));
|
||||
}
|
||||
// write back current status
|
||||
|
||||
Reference in New Issue
Block a user