Bug 1068218: Don't pass lone surrogates to GetDirectionFromChar, r=ehsan

This commit is contained in:
Simon Montagu 2014-09-19 00:18:47 -07:00
parent ec1e4bc2cd
commit 7462d278ae

View File

@ -320,12 +320,15 @@ GetDirectionFromText(const char16_t* aText, const uint32_t aLength,
current++;
}
Directionality dir = GetDirectionFromChar(ch);
if (dir != eDir_NotSet) {
if (aFirstStrong) {
*aFirstStrong = current;
// Just ignore lone surrogates
if (!IS_SURROGATE(ch)) {
Directionality dir = GetDirectionFromChar(ch);
if (dir != eDir_NotSet) {
if (aFirstStrong) {
*aFirstStrong = current;
}
return dir;
}
return dir;
}
}