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 aaa8beab88

Change-Id: I1fdc8f3f4ea43e4814f02dbf615ad128bfc9a059
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-07 18:18:48 +01:00
parent 154e3df17e
commit 6a7f5be0ea

View File

@@ -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('@');