mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
AK: Explicitly check for null data in Utf16View
The underlying CPU-specific instructions for operating on UTF-16 strings behave differently for null inputs. Add an explicit check for this state for consistency.
This commit is contained in:
parent
144452d638
commit
74d644a216
Notes:
github-actions[bot]
2024-07-21 17:58:00 +00:00
Author: https://github.com/trflynn89
Commit: 74d644a216
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/734
Reviewed-by: https://github.com/jamierocks ✅
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 34 additions and 0 deletions
|
@ -49,6 +49,8 @@ ErrorOr<String> String::from_utf16(Utf16View const& utf16)
|
|||
{
|
||||
if (!utf16.validate())
|
||||
return Error::from_string_literal("String::from_utf16: Input was not valid UTF-16");
|
||||
if (utf16.is_empty())
|
||||
return String {};
|
||||
|
||||
String result;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue