forked from qt-creator/qt-creator
CMake: Fix crash when opening project
The CMakeBuildStep can be part of a deploy configuration, and then the buildConfiguration() relies on the "active" build configuration. That can be nullptr under some conditions, e.g. we got crash reports for loading projects, where ProjectExplorer::Target::addConfigurationsFromMap might either not restore any build configuration for some reason, or not set an "active" one. Restoring the deploy configurations in that same method afterwards, then leads a call to baseEnvironment() of the deploy step (=CMakeBuildStep) and a crash. Change-Id: I763d9fdbc7a6055eac384e4c5040c3f7b245d3cb Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -781,7 +781,8 @@ Environment CMakeBuildStep::baseEnvironment() const
|
||||
ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit());
|
||||
result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment();
|
||||
}
|
||||
buildConfiguration()->addToEnvironment(result);
|
||||
if (buildConfiguration())
|
||||
buildConfiguration()->addToEnvironment(result);
|
||||
kit()->addToBuildEnvironment(result);
|
||||
result.modify(project()->additionalEnvironment());
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user