summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d792c6ed..7e1080a5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -621,6 +621,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 = "";