Skip to content

Commit

Permalink
Fix image saving for nonexistent pictures location
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blabber authored and lmoureaux committed Jan 7, 2024
1 parent c6a762d commit b0026cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit b0026cf

Please sign in to comment.