Skip to content

Commit

Permalink
Merge pull request #308 from Krakonos/issue-307-crash-on-download-wit…
Browse files Browse the repository at this point in the history
…h-no-config

FIX: Fixed a crash on download when no server is loaded from config.
  • Loading branch information
Krakonos authored Oct 2, 2024
2 parents 56f772e + 61fac77 commit 7522394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Preferences/MerkaartorPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ void MerkaartorPreferences::initialize()

}

if (theOsmServers.size() == 0) {
theOsmServers.append(defaultOsmServerInfo);
qDebug(lc_MerkaartorPreferences) << "No OSM servers found, adding default server.";
}

//Ensure we have a CacheDir value in QSettings
if (!g_Merk_Ignore_Preferences)
Sets->setValue("backgroundImage/CacheDir", Sets->value("backgroundImage/CacheDir", HOMEDIR + "/BackgroundCache"));
Expand Down
2 changes: 2 additions & 0 deletions src/Utils/OsmServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ struct OsmServerInfo
int CfgVersion = 1;
};

OsmServerInfo const defaultOsmServerInfo = OsmServerInfo{true, OsmServerInfo::AuthType::OAuth2Redirect, "https://www.openstreetmap.org/", "", ""};

class IOsmServerImpl : public QObject {
Q_OBJECT

Expand Down

0 comments on commit 7522394

Please sign in to comment.