diff options
| -rw-r--r-- | builtins/text.c | 3 | ||||
| -rw-r--r-- | test/text.tm | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/builtins/text.c b/builtins/text.c index a9a246ee..99d17577 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -1610,7 +1610,8 @@ public Text_t Text$from_codepoint_names(array_t codepoint_names) Text_t *name = ((Text_t*)(codepoint_names.data + i*codepoint_names.stride)); const char *name_str = Text$as_c_string(*name); uint32_t codepoint = unicode_name_character(name_str); - Array$insert(&codepoints, &codepoint, I_small(0), sizeof(uint32_t)); + if (codepoint != UNINAME_INVALID) + Array$insert(&codepoints, &codepoint, I_small(0), sizeof(uint32_t)); } return Text$from_codepoints(codepoints); } diff --git a/test/text.tm b/test/text.tm index f0f289fe..d82a38c7 100644 --- a/test/text.tm +++ b/test/text.tm @@ -217,3 +217,6 @@ func main(): >> "🐧":codepoint_names() = ["PENGUIN"] + >> Text.from_codepoint_names(["not a valid name here buddy"]) + = "" + |
