diff options
Diffstat (limited to 'tools/assistant/lib')
-rw-r--r-- | tools/assistant/lib/qhelp_global.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index e6a26c4..8e96b55 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -89,10 +89,11 @@ QString QHelpGlobal::codecFromHtmlData(const QByteArray &data) QString head = QString::fromUtf8(data.constData(), qMin(1000, data.size())); int start = head.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); if (start > 0) { - int end; QRegExp r(QLatin1String("charset=([^\"\\s]+)")); while (start != -1) { - end = head.indexOf(QLatin1Char('>'), start) + 1; + const int end = head.indexOf(QLatin1Char('>'), start) + 1; + if (end <= start) + break; const QString &meta = head.mid(start, end - start).toLower(); if (r.indexIn(meta) != -1) return r.cap(1); |