From 84cf8837bd6c9fe5915f74b074eb973f545f4d23 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 27 Sep 2020 22:09:51 +0200 Subject: [PATCH] addToFavourites: catch exception when saving entry --- window.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/window.cpp b/window.cpp index 61eb623..809a2af 100644 --- a/window.cpp +++ b/window.cpp @@ -135,7 +135,15 @@ void Window::addToFavourites(const EntryPushButton &button) QFileInfo fi{button.getEntryConfig().entryPath}; QString entryName = fi.completeBaseName() + ".qsrun"; userConfig.entryPath = this->settingsProvider->userEntriesPaths()[0] + "/" + entryName; - entryProvider->saveUserEntry(userConfig); + try + { + entryProvider->saveUserEntry(userConfig); + } + catch(std::exception &e) + { + QMessageBox::critical(this, "Failed to save item to favourites", e.what()); + return; + } userEntryButtons.append(createEntryButton(userConfig)); }