mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-22 05:02:00 +00:00
raise exception on character conversion failure
This commit is contained in:
parent
14c2d9402d
commit
ad87ff5462
2 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue