From a52be556bf27a099e88e246fd2c17739a0e24575 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sun, 26 Jun 2022 16:45:50 +0200 Subject: [PATCH] change positon from check_for_next_playlist to prevent index out of bounds, fix #140 --- ffplayout-engine/src/input/playlist.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ffplayout-engine/src/input/playlist.rs b/ffplayout-engine/src/input/playlist.rs index 3b382056..a7b8b51a 100644 --- a/ffplayout-engine/src/input/playlist.rs +++ b/ffplayout-engine/src/input/playlist.rs @@ -277,17 +277,18 @@ impl Iterator for CurrentProgram { // or we fill the gap with a dummy. let last_index = self.nodes.lock().unwrap().len() - 1; self.current_node = self.nodes.lock().unwrap()[last_index].clone(); - self.check_for_next_playlist(); - let new_node = self.nodes.lock().unwrap()[last_index].clone(); let new_length = new_node.begin.unwrap() + new_node.duration; + self.check_for_next_playlist(); + if new_length >= self.config.playlist.length_sec.unwrap() + self.config.playlist.start_sec.unwrap() { self.init_clip(); } else { + // fill missing length from playlist let mut current_time = get_sec(); let (_, total_delta) = get_delta(&self.config, ¤t_time); let mut duration = DUMMY_LEN;