forked from qt-creator/qt-creator
ClangCodeModel: prevent crash on null project info
Change-Id: Iff0c0413aa52821dc883b7f42b04bc8ca5dd4a29 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -379,6 +379,8 @@ GenerateCompilationDbResult generateCompilationDB(const CppEditor::ProjectInfo::
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(!baseDir.isEmpty(), return GenerateCompilationDbResult(QString(),
|
QTC_ASSERT(!baseDir.isEmpty(), return GenerateCompilationDbResult(QString(),
|
||||||
QCoreApplication::translate("ClangUtils", "Could not retrieve build directory.")));
|
QCoreApplication::translate("ClangUtils", "Could not retrieve build directory.")));
|
||||||
|
QTC_ASSERT(projectInfo, return GenerateCompilationDbResult(QString(),
|
||||||
|
"Could not retrieve project info."));
|
||||||
QTC_CHECK(baseDir.ensureWritableDir());
|
QTC_CHECK(baseDir.ensureWritableDir());
|
||||||
QFile compileCommandsFile(baseDir.toString() + "/compile_commands.json");
|
QFile compileCommandsFile(baseDir.toString() + "/compile_commands.json");
|
||||||
const bool fileOpened = compileCommandsFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
const bool fileOpened = compileCommandsFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||||
|
Reference in New Issue
Block a user