diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp index 7aa76915cd0f11..b83597611c847e 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp @@ -92,7 +92,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)