aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-12-07 18:18:48 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-12-08 15:16:15 +0000
commit6a7f5be0eae128eaa16c4459b81cda0302957e85 (patch)
tree8637f60dc90ba0984bfd664728e540952cc81b00
parent154e3df17e4f417c728dd96cf8a569e1fbe63553 (diff)
PluginGenerator: Fix returning the error message
I bet the original intention was to return a new message, so we should assing a new value into the passed pointer rather than change the local copy of a pointer so that it start pointing to the local variable. Amends aaa8beab88dddd7218f6d3c30fb29c04679e2098 Change-Id: I1fdc8f3f4ea43e4814f02dbf615ad128bfc9a059 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp
index c3475fd133..4795c77509 100644
--- a/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp
+++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/plugingenerator.cpp
@@ -295,20 +295,17 @@ QString PluginGenerator::processTemplate(const QString &tmpl,
{
Utils::FileReader reader;
if (!reader.fetch(Utils::FilePath::fromString(tmpl), errorMessage))
- return QString();
-
+ return {};
QString cont = QString::fromUtf8(reader.data());
// Expander needed to handle extra variable "Cpp:PragmaOnce"
Utils::MacroExpander *expander = Utils::globalMacroExpander();
- QString errMsg;
- cont = Utils::TemplateEngine::processText(expander, cont, &errMsg);
- if (!errMsg.isEmpty()) {
+ cont = Utils::TemplateEngine::processText(expander, cont, errorMessage);
+ if (!errorMessage->isEmpty()) {
qWarning("Error processing custom plugin file: %s\nFile:\n%s",
- qPrintable(errMsg), qPrintable(cont));
- errorMessage = &errMsg;
- return QString();
+ qPrintable(*errorMessage), qPrintable(cont));
+ return {};
}
const QChar atChar = QLatin1Char('@');