summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2023-01-28 20:08:25 +0100
committerGitHub <noreply@github.com>2023-01-28 20:08:25 +0100
commitf66720dc1a51880c38a1b353430f3dd701201e0e (patch)
treebf73854af35d9bd4c2012d84ace4e2671c425f44
parentbc2c04c6f2e3fcdecc36221d393aa2f253df5790 (diff)
parent92a724d95c4e5609936784ef7b2ba812113641d8 (diff)
Merge pull request #604 from FSMaxB/fix-accidental-deletion-of-all-passwords
Fix accidental deletion of entire passwordstore
-rw-r--r--src/mainwindow.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 53469272..6e7dcffb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -640,6 +640,14 @@ void MainWindow::addPassword() {
* sure.
*/
void MainWindow::onDelete() {
+ QModelIndex currentIndex = ui->treeView->currentIndex();
+ if (!currentIndex.isValid()) {
+ // This fixes https://github.com/IJHack/QtPass/issues/556
+ // Otherwise the entire password directory would be deleted if
+ // nothing is selected in the tree view.
+ return;
+ }
+
QFileInfo fileOrFolder =
model.fileInfo(proxyModel.mapToSource(ui->treeView->currentIndex()));
QString file = "";