diff --git a/Tests/LibWeb/Text/expected/HTML/select-setValue-after-construction.txt b/Tests/LibWeb/Text/expected/HTML/select-setValue-after-construction.txt new file mode 100644 index 0000000000..7ef22e9a43 --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/select-setValue-after-construction.txt @@ -0,0 +1 @@ +PASS diff --git a/Tests/LibWeb/Text/input/HTML/select-setValue-after-construction.html b/Tests/LibWeb/Text/input/HTML/select-setValue-after-construction.html new file mode 100644 index 0000000000..2b8a71f958 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/select-setValue-after-construction.html @@ -0,0 +1,12 @@ + + diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index eb8d7e55d7..0345356150 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -383,6 +383,9 @@ void HTMLSelectElement::create_shadow_tree_if_needed() void HTMLSelectElement::update_inner_text_element() { + if (!m_inner_text_element) + return; + // Update inner text element to text content of selected option for (auto const& option_element : list_of_options()) { if (option_element->selected()) {