From b0026cfffd117db8f1c7123655a2c4cac3e99bb1 Mon Sep 17 00:00:00 2001 From: Tobias Rehbein Date: Sat, 6 Jan 2024 23:21:04 +0100 Subject: [PATCH] Fix image saving for nonexistent pictures location Saving a map to image fails, if the storage location described by QStandardPaths::PicturesLocation does not exist. Use the fallbacks already defined in the code, if the image would be saved in a nonexistent location. --- client/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/menu.cpp b/client/menu.cpp index baf3e39116..c8992a38c2 100644 --- a/client/menu.cpp +++ b/client/menu.cpp @@ -2795,11 +2795,11 @@ void mr_menu::save_image() auto path = QStandardPaths::writableLocation( QStandardPaths::PicturesLocation); - if (path.isEmpty()) { + if (path.isEmpty() || !QDir(path).exists()) { path = QStandardPaths::writableLocation( QStandardPaths::HomeLocation); } - if (path.isEmpty()) { + if (path.isEmpty() || !QDir(path).exists()) { path = freeciv_storage_dir(); } img_name =