aboutsummaryrefslogtreecommitdiff
path: root/src/transcript.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transcript.rs')
-rw-r--r--src/transcript.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/transcript.rs b/src/transcript.rs
index 2bddb72..eb3459d 100644
--- a/src/transcript.rs
+++ b/src/transcript.rs
@@ -50,7 +50,7 @@ pub struct Transcript {
#[derive(Debug)]
pub enum TranscriptMsg {
NewCue(StreamIndex, SubtitleCue),
- SelectTrack(StreamIndex),
+ SelectTrack(Option<StreamIndex>),
ScrollToCue(usize),
}
@@ -116,14 +116,17 @@ impl SimpleComponent for Transcript {
}
}
TranscriptMsg::SelectTrack(stream_index) => {
- self.active_stream_index = Some(stream_index);
+ self.active_stream_index = stream_index;
// Clear current widgets and populate with selected track's cues
self.active_cues.guard().clear();
- let tracks = TRACKS.read();
- if let Some(track) = tracks.get(&stream_index) {
- for cue in &track.cues {
- self.active_cues.guard().push_back(cue.clone());
+
+ if let Some(stream_ix) = stream_index {
+ let tracks = TRACKS.read();
+ if let Some(track) = tracks.get(&stream_ix) {
+ for cue in &track.cues {
+ self.active_cues.guard().push_back(cue.clone());
+ }
}
}
}