# HG changeset patch # User Michiel Broek # Date 1674572896 -3600 # Node ID 18b72c518d0d38a13b3bf79cc38fdc5ad4e98de6 # Parent 0d7441b39d41e9cd306e00f2d40aac44e29a4e2d Only try to save images on existing paths diff -r 0d7441b39d41 -r 18b72c518d0d src/EditProductTab13.cpp --- a/src/EditProductTab13.cpp Tue Jan 24 15:57:13 2023 +0100 +++ b/src/EditProductTab13.cpp Tue Jan 24 16:08:16 2023 +0100 @@ -328,9 +328,20 @@ void EditProduct::downloadImage_clicked() { QSettings settings(QSettings::IniFormat, QSettings::UserScope, "mbse", "bmsapp"); + QString dirName; + + /* + * First check if the directory stored in the settings file exists. + * It might be on a removable media that was last used ... + * If so, fallback to the user's home directory. + */ + dirName = settings.value("paths/download").toString(); + if (! QDir(dirName).exists()) { + dirName = QDir::homePath(); + } QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), - settings.value("paths/download").toString() + "/" + product->images_list.at(ui->filmStrip->currentRow()).filename, tr("Files (*.png)")); + dirName + "/" + product->images_list.at(ui->filmStrip->currentRow()).filename, tr("Files (*.png)")); if (fileName == 0) { QMessageBox::warning(this, tr("Save File"), tr("No PNG file selected.")); return;