Commit 5ed13efe authored by Clément Fauconnier's avatar Clément Fauconnier

fixed a crash when no document was selected before deletion

parent d0e34731
...@@ -2190,16 +2190,16 @@ void UBDocumentController::deleteSelectedItem() ...@@ -2190,16 +2190,16 @@ void UBDocumentController::deleteSelectedItem()
{ {
UBDocumentTreeModel *docModel = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel; 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) ?"))) if (!UBApplication::mainWindow->yesNoQuestion(tr("Remove Item"), tr("Are you sure you want to remove the selected item(s) ?")))
return; return;
QModelIndexList indexes = selectedTreeIndexes();
if (indexes.size() > 1) if (indexes.size() > 1)
{ {
deleteMultipleItems(indexes, docModel); deleteMultipleItems(indexes, docModel);
} }
else else if (indexes.size() == 1)
{ {
deleteSingleItem(indexes.at(0), docModel); deleteSingleItem(indexes.at(0), docModel);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment