diff --git a/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Libraries/LibWeb/CSS/MediaQueryList.cpp index c3cde8afdc1..c3c727e87db 100644 --- a/Libraries/LibWeb/CSS/MediaQueryList.cpp +++ b/Libraries/LibWeb/CSS/MediaQueryList.cpp @@ -99,7 +99,8 @@ void MediaQueryList::remove_listener(JS::GCPtr listener) // 1. Remove an event listener from the associated list of event listeners, whose type is change, callback is listener, and capture is false. // NOTE: While the spec doesn't technically use remove_event_listener and instead manipulates the list directly, every major engine uses remove_event_listener. // This means if an event listener removes another event listener that comes after it, the removed event listener will not be invoked. - remove_event_listener_without_options(HTML::EventNames::change, *listener); + if (listener) + remove_event_listener_without_options(HTML::EventNames::change, *listener); } void MediaQueryList::set_onchange(WebIDL::CallbackType* event_handler)