We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d4387e commit 45be85eCopy full SHA for 45be85e
src/Data/String/CodePoints.purs
@@ -415,8 +415,10 @@ unsafeCodePointAt0Fallback :: String -> CodePoint
415
unsafeCodePointAt0Fallback s =
416
let
417
cu0 = fromEnum (Unsafe.charAt 0 s)
418
- cu1 = fromEnum (Unsafe.charAt 1 s)
419
in
420
- if isLead cu0 && isTrail cu1
421
- then unsurrogate cu0 cu1
422
- else CodePoint cu0
+ if isLead cu0 && CU.length s > 1
+ then
+ let cu1 = fromEnum (Unsafe.charAt 1 s) in
+ if isTrail cu1 then unsurrogate cu0 cu1 else CodePoint cu0
423
+ else
424
+ CodePoint cu0
0 commit comments