diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 2006efd3cded..12e4d9916e09 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -1886,18 +1886,16 @@ impl Constellation // Remove paint permissions for the pipeline being replaced. self.revoke_paint_permission(old_pipeline_id); - // Add new pipeline to navigation frame, and return frames evicted from history. - self.pipelines - .get(&old_pipeline_id) - .and_then(|pipeline| pipeline.frame) - .map(|frame_id| { - self.pipelines.get_mut(&frame_change.new_pipeline_id) - .map(|pipeline| pipeline.frame = Some(frame_id)); - self.frames.get_mut(&frame_id).map(|frame| frame.load(frame_change.new_pipeline_id)); - frame_id - }) + self.pipelines.get(&old_pipeline_id).and_then(|pipeline| pipeline.frame) }); + if let Some(frame_id) = frame_id { + // Add new pipeline to navigation frame, and return frames evicted from history. + self.pipelines.get_mut(&frame_change.new_pipeline_id) + .map(|pipeline| pipeline.frame = Some(frame_id)); + self.frames.get_mut(&frame_id).map(|frame| frame.load(frame_change.new_pipeline_id)); + } + if let None = frame_id { // The new pipeline is in a new frame with no history let frame_id = self.new_frame(frame_change.new_pipeline_id);