summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-22 16:01:42 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-23 17:31:45 (GMT)
commitd6b1f5704e9d22c371ac30c8b02a188a9d80e6cc (patch)
treef2c483576b88cfb666fd13d0b828ff71f312918c
parent7695b67500d3518c6fc935430e681035a442b692 (diff)
downloadCMake-d6b1f5704e9d22c371ac30c8b02a188a9d80e6cc.zip
CMake-d6b1f5704e9d22c371ac30c8b02a188a9d80e6cc.tar.gz
CMake-d6b1f5704e9d22c371ac30c8b02a188a9d80e6cc.tar.bz2
cmGeneratorTarget: Add missing nullptr checks
Check the result of `GetLinkImplementationLibraries` before using it.
-rw-r--r--Source/cmGeneratorTarget.cxx32
1 files changed, 17 insertions, 15 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 554a954..2284d68 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2790,6 +2790,7 @@ cmGeneratorTarget::GetLinkImplementationClosure(
cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config);
+ assert(impl);
for (cmLinkImplItem const& lib : impl->Libraries) {
processILibs(config, this, lib,
@@ -3436,23 +3437,24 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
&dagChecker, entries);
if (this->Makefile->IsOn("APPLE")) {
- cmLinkImplementationLibraries const* impl =
- this->GetLinkImplementationLibraries(config);
- for (cmLinkImplItem const& lib : impl->Libraries) {
- std::string libDir = cmSystemTools::CollapseFullPath(
- lib.AsStr(), this->Makefile->GetHomeOutputDirectory());
-
- static cmsys::RegularExpression frameworkCheck(
- "(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
- if (!frameworkCheck.find(libDir)) {
- continue;
- }
+ if (cmLinkImplementationLibraries const* impl =
+ this->GetLinkImplementationLibraries(config)) {
+ for (cmLinkImplItem const& lib : impl->Libraries) {
+ std::string libDir = cmSystemTools::CollapseFullPath(
+ lib.AsStr(), this->Makefile->GetHomeOutputDirectory());
+
+ static cmsys::RegularExpression frameworkCheck(
+ "(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
+ if (!frameworkCheck.find(libDir)) {
+ continue;
+ }
- libDir = frameworkCheck.match(1);
+ libDir = frameworkCheck.match(1);
- EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace());
- ee.Values.emplace_back(std::move(libDir));
- entries.Entries.emplace_back(std::move(ee));
+ EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace());
+ ee.Values.emplace_back(std::move(libDir));
+ entries.Entries.emplace_back(std::move(ee));
+ }
}
}