From 5ed13efe0bc32b4790e2dcf662ecd41a360fb6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Mon, 19 Nov 2018 09:55:43 +0100 Subject: [PATCH] fixed a crash when no document was selected before deletion --- src/document/UBDocumentController.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 4ad1f86d..bab126c8 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -2190,16 +2190,16 @@ void UBDocumentController::deleteSelectedItem() { UBDocumentTreeModel *docModel = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel; - QModelIndexList indexes = selectedTreeIndexes(); - if (!UBApplication::mainWindow->yesNoQuestion(tr("Remove Item"), tr("Are you sure you want to remove the selected item(s) ?"))) return; + QModelIndexList indexes = selectedTreeIndexes(); + if (indexes.size() > 1) { deleteMultipleItems(indexes, docModel); } - else + else if (indexes.size() == 1) { deleteSingleItem(indexes.at(0), docModel); }