diff options
author | Brad King <brad.king@kitware.com> | 2020-07-22 16:01:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-07-23 17:31:45 (GMT) |
commit | 7695b67500d3518c6fc935430e681035a442b692 (patch) | |
tree | 61f07fbc349d756d1e131f703bf04df31703b1fa /Source/cmComputeTargetDepends.cxx | |
parent | 95b5df8646fa2b02c5eba175570f83fc6e2ece55 (diff) | |
download | CMake-7695b67500d3518c6fc935430e681035a442b692.zip CMake-7695b67500d3518c6fc935430e681035a442b692.tar.gz CMake-7695b67500d3518c6fc935430e681035a442b692.tar.bz2 |
cmComputeTargetDepends: Add missing nullptr check
Check the result of `GetLinkImplementation` before using it.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 6846f57..06ad64d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -198,16 +198,18 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::vector<std::string> const& configs = depender->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); for (std::string const& it : configs) { - cmLinkImplementation const* impl = depender->GetLinkImplementation(it); - // A target should not depend on itself. emitted.insert(cmLinkItem(depender, false, cmListFileBacktrace())); emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace())); - for (cmLinkImplItem const& lib : impl->Libraries) { - // Don't emit the same library twice for this target. - if (emitted.insert(lib).second) { - this->AddTargetDepend(depender_index, lib, true, false); - this->AddInterfaceDepends(depender_index, lib, it, emitted); + + if (cmLinkImplementation const* impl = + depender->GetLinkImplementation(it)) { + for (cmLinkImplItem const& lib : impl->Libraries) { + // Don't emit the same library twice for this target. + if (emitted.insert(lib).second) { + this->AddTargetDepend(depender_index, lib, true, false); + this->AddInterfaceDepends(depender_index, lib, it, emitted); + } } } |