From c2165fb6b87c3db9abec98edf3b5570295ec3b1a Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 22 Dec 2024 19:50:25 -0500 Subject: [PATCH] LibWeb/Animations: Don't try to associate animations to null timelines The input to `set_timeline` is user controlled, it can be null. --- Libraries/LibWeb/Animations/Animation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/Animations/Animation.cpp b/Libraries/LibWeb/Animations/Animation.cpp index 9872c2dbded..02f77308526 100644 --- a/Libraries/LibWeb/Animations/Animation.cpp +++ b/Libraries/LibWeb/Animations/Animation.cpp @@ -99,8 +99,6 @@ void Animation::set_effect(GC::Ptr new_effect) // https://www.w3.org/TR/web-animations-1/#animation-set-the-timeline-of-an-animation void Animation::set_timeline(GC::Ptr new_timeline) { - // Setting this attribute updates the object’s timeline using the procedure to set the timeline of an animation. - // 1. Let old timeline be the current timeline of animation, if any. auto old_timeline = m_timeline; @@ -112,7 +110,8 @@ void Animation::set_timeline(GC::Ptr new_timeline) if (m_timeline) m_timeline->disassociate_with_animation(*this); m_timeline = new_timeline; - m_timeline->associate_with_animation(*this); + if (m_timeline) + m_timeline->associate_with_animation(*this); // 4. If the start time of animation is resolved, make animation’s hold time unresolved. if (m_start_time.has_value())