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:
parent
dde2ef5972
commit
7c9b1b391f
1 changed files with 8 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue