raise exception on character conversion failure

This commit is contained in:
Richard Frith-Macdonald 2018-02-07 10:38:57 +00:00
parent 14c2d9402d
commit ad87ff5462
2 changed files with 6 additions and 2 deletions

View file

@ -2120,8 +2120,11 @@ characterAtIndex_c(GSStr self, unsigned index)
unsigned int s = 1;
unichar *d = &u;
u = 0; // If conversion fails we use zero
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
if (GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0) == NO)
{
[NSException raise: NSInternalInconsistencyException
format: @"unable to convert character to unicode"];
}
}
return u;
}