mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
|
@ -3,6 +3,7 @@
|
|||
* Source/GSAttributedString.m: remove a little dead code
|
||||
* Tests/base/NSMutableAttributedString/test00.m: add sanity checks
|
||||
* Tests/base/NSMutableAttributedString/test01.m: add sanity checks
|
||||
* Source/GSString.m: raise exception on character conversion failure
|
||||
|
||||
2018-02-07 Yavor Doganov <yavor@gnu.org>
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue