mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +00:00
LibTextCodec: Use Optional<String> for get_standardized_encoding
This patch changes get_standardized_encoding to use an Optional<String> return type instead of just returning the null string when unable to match the provided encoding to one of the canonical encoding names. This is part of an effort to move away from using null strings towards explicitly using Optional<String> to indicate that the String may not have a value.
This commit is contained in:
parent
f51b0729f5
commit
d325403cb5
3 changed files with 21 additions and 16 deletions
|
@ -104,7 +104,9 @@ HTMLDocumentParser::HTMLDocumentParser(DOM::Document& document, const StringView
|
|||
, m_document(document)
|
||||
{
|
||||
m_document->set_should_invalidate_styles_on_attribute_changes(false);
|
||||
m_document->set_encoding(TextCodec::get_standardized_encoding(encoding));
|
||||
auto standardized_encoding = TextCodec::get_standardized_encoding(encoding);
|
||||
VERIFY(standardized_encoding.has_value());
|
||||
m_document->set_encoding(standardized_encoding.value());
|
||||
}
|
||||
|
||||
HTMLDocumentParser::~HTMLDocumentParser()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue