diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index faa00555f8..ad9df045e7 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -241,12 +241,10 @@ void DocumentRecovery::accept() if (!d->recovered) { WaitCursor wc; - int index = -1; + int index = 0; std::vector indices; std::vector 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