summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-06-16 11:32:09 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-18 13:36:23 +0200
commite3dadce470bcc020dc11331be1877a10e70786a6 (patch)
tree7b2b85a8957addedb06ad78e2604643d14e83f08 /src/corelib
parent41dbfd8888e14440041907ac646c2e63284d50c7 (diff)
Ensure we don't repeat QTBUG-30931 in Qt5
The issue is already fixed in 5.0 but let's be nice and ensure the issue won't be reintroduced later. Task-number: QTBUG-30931 Change-Id: Ia6944acaf6e7217f8d0f1fa75d0e9977db11d892 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qchar.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 8545276dac..9ab7155c2d 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1739,10 +1739,10 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
if (from < 0 || s.length() - from < 2)
return;
- int starter = 0; // starter position
uint stcode = 0; // starter code point
- int next = -1;
- int lastCombining = 0;
+ int starter = -1; // starter position
+ int next = -1; // to prevent i == next
+ int lastCombining = 255; // to prevent combining > lastCombining
int pos = from;
while (pos < s.length()) {
@@ -1766,8 +1766,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
}
int combining = p->combiningClass;
- if (i == next || combining > lastCombining) {
- Q_ASSERT(starter >= from);
+ if ((i == next || combining > lastCombining) && starter >= from) {
// allowed to form ligature with S
uint ligature = ligatureHelper(stcode, uc);
if (ligature) {