[SR-1930] Passing an invalid value to UnicodeScalar initializer crashes the app #44539
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
swift evolution proposal needed
Flag → feature: A feature that warrants a Swift evolution proposal
Environment
Tested on Xcode Version 7.3.1 (7D1014), but happens in newer versions too.
Additional Detail from JIRA
md5: 55ec1ebb5dd1238e7abbe723f7df69c9
Issue Description:
What happens:
When you pass an invalid value to the
UnicodeScalar
initializer the swift stdlib crashes the program by calling_precondition
this is bad if you construct a unicode scalar from user input (e.g. JSON parser)Example:
What do I expect:
Either the initializer is non-failable or it should be marked as failable and throw an error, but crashing the whole app seems like a bad idea. The documentation states:
But it does in no way mention that the app will crash otherwise.
NOTE: Requires a swift-evolution proposal.
The text was updated successfully, but these errors were encountered: