mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:22:46 +00:00 
			
		
		
		
	LibUnicode: Propagate try_append() errors when building emoji data
This commit is contained in:
		
							parent
							
								
									f064f5f36e
								
							
						
					
					
						commit
						01fa3bb788
					
				
					 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.group = Unicode::EmojiGroup::SerenityOS; | ||||||
|         emoji.display_order = display_order++; |         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)) { |             if (segment.starts_with(code_point_header)) { | ||||||
|                 segment = segment.substring_view(code_point_header.length()); |                 segment = segment.substring_view(code_point_header.length()); | ||||||
| 
 | 
 | ||||||
|                 auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(segment); |                 auto code_point = AK::StringUtils::convert_to_uint_from_hex<u32>(segment); | ||||||
|                 VERIFY(code_point.has_value()); |                 VERIFY(code_point.has_value()); | ||||||
| 
 | 
 | ||||||
|                 emoji.code_points.append(*code_point); |                 TRY(emoji.code_points.try_append(*code_point)); | ||||||
|             } else { |             } else { | ||||||
|                 if (!builder.is_empty()) |                 if (!builder.is_empty()) | ||||||
|                     builder.append(' '); |                     TRY(builder.try_append(' ')); | ||||||
|                 builder.append(segment); |                 TRY(builder.try_append(segment)); | ||||||
|             } |             } | ||||||
|         }); |             return {}; | ||||||
|  |         })); | ||||||
| 
 | 
 | ||||||
|         auto name = builder.to_deprecated_string(); |         auto name = builder.to_deprecated_string(); | ||||||
|         if (!any_of(name, is_ascii_lower_alpha)) |         if (!any_of(name, is_ascii_lower_alpha)) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 MacDue
						MacDue