aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gleam/string.gleam1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam
index a87b343..8802f09 100644
--- a/src/gleam/string.gleam
+++ b/src/gleam/string.gleam
@@ -811,6 +811,7 @@ pub fn utf_codepoint(value: Int) -> Result(UtfCodepoint, Nil) {
i if i > 1_114_111 -> Error(Nil)
65_534 | 65_535 -> Error(Nil)
i if i >= 55_296 && i <= 57_343 -> Error(Nil)
+ i if i < 0 -> Error(Nil)
i -> Ok(unsafe_int_to_utf_codepoint(i))
}
}