mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibUnicode: Propagate try_append() errors when building emoji data
This commit is contained in:
parent
f064f5f36e
commit
01fa3bb788
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/01fa3bb788 Pull-request: https://github.com/SerenityOS/serenity/pull/17606 Reviewed-by: https://github.com/ADKaster
1 changed files with 6 additions and 5 deletions
|
@ -140,20 +140,21 @@ static ErrorOr<void> parse_emoji_serenity_data(Core::BufferedFile& file, EmojiDa
|
|||
emoji.group = Unicode::EmojiGroup::SerenityOS;
|
||||
emoji.display_order = display_order++;
|
||||
|
||||
line.for_each_split_view(' ', SplitBehavior::Nothing, [&](auto segment) {
|
||||
TRY(line.for_each_split_view(' ', SplitBehavior::Nothing, [&](auto segment) -> ErrorOr<void> {
|
||||
if (segment.starts_with(code_point_header)) {
|
||||
segment = segment.substring_view(code_point_header.length());
|
||||
|
||||
auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(segment);
|
||||
VERIFY(code_point.has_value());
|
||||
|
||||
emoji.code_points.append(*code_point);
|
||||
TRY(emoji.code_points.try_append(*code_point));
|
||||
} else {
|
||||
if (!builder.is_empty())
|
||||
builder.append(' ');
|
||||
builder.append(segment);
|
||||
TRY(builder.try_append(' '));
|
||||
TRY(builder.try_append(segment));
|
||||
}
|
||||
});
|
||||
return {};
|
||||
}));
|
||||
|
||||
auto name = builder.to_deprecated_string();
|
||||
if (!any_of(name, is_ascii_lower_alpha))
|
||||
|
|
Loading…
Reference in a new issue