From 5fd284cf3ac6c874d44abaa7983726fd4fb4e158 Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Thu, 5 Jan 2017 12:08:03 +0000 Subject: [PATCH] Index the session past correctly when discarding. --- components/constellation/constellation.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index f5a5983fa9b..76537234f09 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -2110,7 +2110,8 @@ impl Constellation } else if let Some(frame) = self.frames.get_mut(&frame_change.frame_id) { debug!("Adding pipeline to existing frame."); frame.load(frame_change.new_pipeline_id, frame_change.url.clone()); - let evicted_id = frame.prev.get_mut(opts::get().max_session_history) + let evicted_id = frame.prev.len().checked_sub(opts::get().max_session_history) + .and_then(|index| frame.prev.get_mut(index)) .and_then(|entry| entry.pipeline_id.take()); (evicted_id, false, true, true) } else {