forked from qt-creator/qt-creator
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:
@@ -295,20 +295,17 @@ QString PluginGenerator::processTemplate(const QString &tmpl,
|
|||||||
{
|
{
|
||||||
Utils::FileReader reader;
|
Utils::FileReader reader;
|
||||||
if (!reader.fetch(Utils::FilePath::fromString(tmpl), errorMessage))
|
if (!reader.fetch(Utils::FilePath::fromString(tmpl), errorMessage))
|
||||||
return QString();
|
return {};
|
||||||
|
|
||||||
|
|
||||||
QString cont = QString::fromUtf8(reader.data());
|
QString cont = QString::fromUtf8(reader.data());
|
||||||
|
|
||||||
// Expander needed to handle extra variable "Cpp:PragmaOnce"
|
// Expander needed to handle extra variable "Cpp:PragmaOnce"
|
||||||
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
Utils::MacroExpander *expander = Utils::globalMacroExpander();
|
||||||
QString errMsg;
|
cont = Utils::TemplateEngine::processText(expander, cont, errorMessage);
|
||||||
cont = Utils::TemplateEngine::processText(expander, cont, &errMsg);
|
if (!errorMessage->isEmpty()) {
|
||||||
if (!errMsg.isEmpty()) {
|
|
||||||
qWarning("Error processing custom plugin file: %s\nFile:\n%s",
|
qWarning("Error processing custom plugin file: %s\nFile:\n%s",
|
||||||
qPrintable(errMsg), qPrintable(cont));
|
qPrintable(*errorMessage), qPrintable(cont));
|
||||||
errorMessage = &errMsg;
|
return {};
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QChar atChar = QLatin1Char('@');
|
const QChar atChar = QLatin1Char('@');
|
||||||
|
|||||||
Reference in New Issue
Block a user