aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/proparser/qmakeevaluator.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp
index 0ea6c7f1334..36e82bf25a0 100644
--- a/src/shared/proparser/qmakeevaluator.cpp
+++ b/src/shared/proparser/qmakeevaluator.cpp
@@ -877,10 +877,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
QRegularExpression regexp(pattern, case_sense ? QRegularExpression::NoPatternOption :
QRegularExpression::CaseInsensitiveOption);
- // We could make a union of modified and unmodified values,
- // but this will break just as much as it fixes, so leave it as is.
- replaceInList(&valuesRef(varName), regexp, replace, global, m_tmp2);
- debugMsg(2, "replaced %s with %s", dbgQStr(pattern), dbgQStr(replace));
+ try
+ {
+ // We could make a union of modified and unmodified values,
+ // but this will break just as much as it fixes, so leave it as is.
+ replaceInList(&valuesRef(varName), regexp, replace, global, m_tmp2);
+ debugMsg(2, "replaced %s with %s", dbgQStr(pattern), dbgQStr(replace));
+ } catch (const std::bad_alloc &e) {
+ qWarning() << "Bad alloc caught in replaceInList:" << e.what();
+ return ReturnError;
+ }
} else {
ProStringList varVal;
if (expandVariableReferences(tokPtr, sizeHint, &varVal, false) == ReturnError)