forked from qt-creator/qt-creator
CompilationDatabasePM: Fix crash at loading project
If rootPath is empty, QtCreator will crash. Fixes: QTCREATORBUG-26126 Change-Id: Iac0d29d84d7203c0ec2ac8f5e3035816f52d7cdc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -440,8 +440,13 @@ Utils::FilePath CompilationDatabaseProject::rootPathFromSettings() const
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
return Utils::FilePath::fromString(projectDirectory().fileName());
|
return Utils::FilePath::fromString(projectDirectory().fileName());
|
||||||
#else
|
#else
|
||||||
return Utils::FilePath::fromString(
|
auto rootPath = Utils::FilePath::fromString(
|
||||||
namedSettings(ProjectExplorer::Constants::PROJECT_ROOT_PATH_KEY).toString());
|
namedSettings(ProjectExplorer::Constants::PROJECT_ROOT_PATH_KEY).toString());
|
||||||
|
|
||||||
|
if (rootPath.isEmpty())
|
||||||
|
rootPath = Utils::FilePath::fromString(projectDirectory().fileName());
|
||||||
|
|
||||||
|
return rootPath;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user