1
0
Fork 0

Guard against SGPath::document()s returning null

Underlying bug is fixed in SimGear, but let's also guard against a failure here,
by falling back to FG_HOME on Windows.

For discussion see:
https://sourceforge.net/p/flightgear/codetickets/2019/
This commit is contained in:
James Turner 2018-06-15 11:10:51 +01:00
parent dde2ef5972
commit 7c9b1b391f

View file

@ -2456,11 +2456,15 @@ SGPath defaultDownloadDir()
{
#if defined(SG_WINDOWS)
SGPath p(SGPath::documents());
p.append("FlightGear");
#else
SGPath p(globals->get_fg_home());
if (p.isNull()) {
SG_LOG(SG_IO, SG_ALERT, "Failed to locate user's Documents directory, will default to FG_HOME");
// fall through to standard get_fg_home codepath
} else {
return p / "FlightGear";
}
#endif
return p;
return globals->get_fg_home();
}
OptionResult Options::processOptions()