change positon from check_for_next_playlist to prevent index out of bounds, fix #140
This commit is contained in:
parent
77358fb140
commit
a52be556bf
@ -277,17 +277,18 @@ impl Iterator for CurrentProgram {
|
|||||||
// or we fill the gap with a dummy.
|
// or we fill the gap with a dummy.
|
||||||
let last_index = self.nodes.lock().unwrap().len() - 1;
|
let last_index = self.nodes.lock().unwrap().len() - 1;
|
||||||
self.current_node = self.nodes.lock().unwrap()[last_index].clone();
|
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_node = self.nodes.lock().unwrap()[last_index].clone();
|
||||||
let new_length = new_node.begin.unwrap() + new_node.duration;
|
let new_length = new_node.begin.unwrap() + new_node.duration;
|
||||||
|
|
||||||
|
self.check_for_next_playlist();
|
||||||
|
|
||||||
if new_length
|
if new_length
|
||||||
>= self.config.playlist.length_sec.unwrap()
|
>= self.config.playlist.length_sec.unwrap()
|
||||||
+ self.config.playlist.start_sec.unwrap()
|
+ self.config.playlist.start_sec.unwrap()
|
||||||
{
|
{
|
||||||
self.init_clip();
|
self.init_clip();
|
||||||
} else {
|
} else {
|
||||||
|
// fill missing length from playlist
|
||||||
let mut current_time = get_sec();
|
let mut current_time = get_sec();
|
||||||
let (_, total_delta) = get_delta(&self.config, ¤t_time);
|
let (_, total_delta) = get_delta(&self.config, ¤t_time);
|
||||||
let mut duration = DUMMY_LEN;
|
let mut duration = DUMMY_LEN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user