summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-02-19 17:11:53 +1100
committerCraig Scott <craig.scott@crascit.com>2021-02-19 17:11:53 +1100
commit90c2f138ee27ad7b36c058e9e791b6359793f58b (patch)
treee5b3c6b87ddb923fc92c1b03b83e6719d31e1d1f /Source
parent50fc9d5b45a7dcbb11152ea77b2d47c66e277265 (diff)
downloadcmake-90c2f138ee27ad7b36c058e9e791b6359793f58b.tar.gz
CPackIFWInstaller: Avoid potential null pointer dereference
In d16830324f (CPackIFW: Improve warning and docs for show page list option, 2021-02-14), code was added to report the current QtIFW version. That code didn't check that there was a Generator object before using it, resulting in a scanbuild warning about a potential null pointer dereference. Add a check and output a more general warning message if we don't have the current QtIFW version available to report.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index e0dd06b482..bf8b457b4a 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -186,13 +186,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->WizardShowPageList.clear();
}
} else {
+ std::string currentVersionMsg;
+ if (this->Generator) {
+ currentVersionMsg =
+ "QtIFW version " + this->Generator->FrameworkVersion;
+ } else {
+ currentVersionMsg = "an older QtIFW version";
+ }
cmCPackIFWLogger(
WARNING,
"Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to \""
<< option
<< "\", but it is only supported with QtIFW version 4.0 or later. "
- "It is being ignored because you are using QtIFW version "
- << this->Generator->FrameworkVersion.data() << std::endl);
+ "It is being ignored because you are using "
+ << currentVersionMsg << std::endl);
}
}