From e3dadce470bcc020dc11331be1877a10e70786a6 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 16 Jun 2013 11:32:09 +0300 Subject: 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 --- src/corelib/tools/qchar.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/corelib') 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) { -- cgit v1.2.3