Fix charCodeAt if index is out of range

This commit is contained in:
Joshua Granick
2017-08-09 11:07:29 -07:00
parent 09f95badda
commit e503ed6b6e

View File

@@ -54,7 +54,8 @@ abstract UTF8String(String) from String to String {
**/
public function charCodeAt (index:Int):Null<Int> {
return Utf8.charCodeAt (this, index);
if (index < 0 || index >= Unifill.uLength (this)) return null;
return Unifill.uCharCodeAt (this, index);
}