diff --git a/templateparser/src/templateparserjob.cpp b/templateparser/src/templateparserjob.cpp index 3db919d0472ef93923c5556c4db4834d395dd219..ea87ff06b68c83ebac7d59ce9d1be0ce30a557f8 100644 --- a/templateparser/src/templateparserjob.cpp +++ b/templateparser/src/templateparserjob.cpp @@ -1544,16 +1544,19 @@ QString TemplateParserJob::plainTextToHtml(const QString &body) void TemplateParserJob::makeValidHtml(QString &body) { - QRegExp regEx; - regEx.setMinimal(true); - regEx.setPattern(QStringLiteral("")); + if (body.isEmpty()) { + return; + } + + QRegularExpression regEx; - if (!body.isEmpty() && !body.contains(regEx)) { - regEx.setPattern(QStringLiteral("")); + regEx.setPattern(QStringLiteral("")); + if (!body.contains(regEx)) { + regEx.setPattern(QStringLiteral("")); if (!body.contains(regEx)) { body = QLatin1String("") + body + QLatin1String("
"); } - regEx.setPattern(QStringLiteral("")); + regEx.setPattern(QStringLiteral("")); if (!body.contains(regEx)) { body = QLatin1String("") + d->mHeadElement + QLatin1String("") + body; }