Skip to content
Snippets Groups Projects
Commit 468f7bef authored by Dimitar Tasev's avatar Dimitar Tasev
Browse files

Re #19961 fixed crash when ~/.mantid/instrument does not exist

parent 97be5d8c
No related branches found
No related tags found
No related merge requests found
...@@ -81,7 +81,7 @@ Logger g_log("ConfigService"); ...@@ -81,7 +81,7 @@ Logger g_log("ConfigService");
* Split the supplied string on semicolons. * Split the supplied string on semicolons.
* *
* @param path The path to split. * @param path The path to split.
* @returns vector containing the splitted path. * @returns vector containing the split path.
*/ */
std::vector<std::string> splitPath(const std::string &path) { std::vector<std::string> splitPath(const std::string &path) {
std::vector<std::string> splitted; std::vector<std::string> splitted;
...@@ -236,8 +236,6 @@ ConfigServiceImpl::ConfigServiceImpl() ...@@ -236,8 +236,6 @@ ConfigServiceImpl::ConfigServiceImpl()
propertiesFilesList += ", " + getUserFilename(); propertiesFilesList += ", " + getUserFilename();
} }
updateFacilities();
g_log.debug() << "ConfigService created.\n"; g_log.debug() << "ConfigService created.\n";
g_log.debug() << "Configured Mantid.properties directory of application as " g_log.debug() << "Configured Mantid.properties directory of application as "
<< getPropertiesDir() << '\n'; << getPropertiesDir() << '\n';
...@@ -280,6 +278,14 @@ ConfigServiceImpl::ConfigServiceImpl() ...@@ -280,6 +278,14 @@ ConfigServiceImpl::ConfigServiceImpl()
} }
// must update the cache of instrument paths // must update the cache of instrument paths
cacheInstrumentPaths(); cacheInstrumentPaths();
// update the facilities AFTER we have ensured that all of the directories are
// created and the paths updated
// if we don't do that first the function below will silently fail without
// initialising the facilities vector
// and Mantid will crash when it tries to access them, for example when
// creating the first time startup screen
updateFacilities();
} }
/** Private Destructor /** Private Destructor
...@@ -1794,8 +1800,7 @@ std::string ConfigServiceImpl::getFacilityFilename(const std::string &fName) { ...@@ -1794,8 +1800,7 @@ std::string ConfigServiceImpl::getFacilityFilename(const std::string &fName) {
/** /**
* Load facility information from instrumentDir/Facilities.xml file if fName * Load facility information from instrumentDir/Facilities.xml file if fName
* parameter * parameter is not set
* is not set
* @param fName :: An alternative file name for loading facilities information. * @param fName :: An alternative file name for loading facilities information.
*/ */
void ConfigServiceImpl::updateFacilities(const std::string &fName) { void ConfigServiceImpl::updateFacilities(const std::string &fName) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment