Browse Source

Projucer: Fixed a potential crash when setting a global path from the command line

tags/2021-05-28
ed 7 years ago
parent
commit
6a3825f88f
2 changed files with 14 additions and 4 deletions
  1. +10
    -4
      extras/Projucer/Source/Application/jucer_CommandLine.cpp
  2. +4
    -0
      extras/Projucer/Source/Settings/jucer_StoredSettings.cpp

+ 10
- 4
extras/Projucer/Source/Application/jucer_CommandLine.cpp View File

@@ -712,6 +712,10 @@ namespace
auto settingsFile = userAppData.getChildFile ("Projucer").getChildFile ("Projucer.settings");
std::unique_ptr<XmlElement> xml (XmlDocument::parse (settingsFile));
if (xml == nullptr)
ConsoleApplication::fail ("Settings file not valid!");
auto settingsTree = ValueTree::fromXml (*xml);
if (! settingsTree.isValid())
@@ -722,13 +726,13 @@ namespace
if (isThisOS (args[1].text))
{
childToSet = settingsTree.getChildWithProperty (Ids::name, "PROJECT_DEFAULT_SETTINGS")
.getChildWithName ("PROJECT_DEFAULT_SETTINGS");
.getOrCreateChildWithName ("PROJECT_DEFAULT_SETTINGS", nullptr);
}
else
{
childToSet = settingsTree.getChildWithProperty (Ids::name, "FALLBACK_PATHS")
.getChildWithName ("FALLBACK_PATHS")
.getChildWithName (args[1].text + "Fallback");
.getOrCreateChildWithName ("FALLBACK_PATHS", nullptr)
.getOrCreateChildWithName (args[1].text + "Fallback", nullptr);
}
if (! childToSet.isValid())
@@ -737,7 +741,9 @@ namespace
if (args[2].text == Ids::defaultUserModulePath.toString())
{
auto pathList = args[3].text.removeCharacters ("\"");
checkIfUserModulesPathsAreValid (pathList);
if (isThisOS (args[1].text))
checkIfUserModulesPathsAreValid (pathList);
childToSet.setProperty (args[2].text, pathList, nullptr);
}


+ 4
- 0
extras/Projucer/Source/Settings/jucer_StoredSettings.cpp View File

@@ -46,7 +46,11 @@ StoredSettings::StoredSettings()
fallbackPaths ("FALLBACK_PATHS")
{
updateOldProjectSettingsFiles();
reload();
changed (true);
flush();
checkJUCEPaths();
projectDefaults.addListener (this);


Loading…
Cancel
Save