mirror of
https://github.com/sile/hls_m3u8.git
synced 2025-01-11 04:35:24 +00:00
Fix the unexpected panic reported by #2
This commit is contained in:
parent
807b73a701
commit
3122949384
1 changed files with 7 additions and 1 deletions
|
@ -175,7 +175,7 @@ impl MediaPlaylistBuilder {
|
||||||
.chain(self.end_list_tag.iter().map(|t| t.requires_version()))
|
.chain(self.end_list_tag.iter().map(|t| t.requires_version()))
|
||||||
.chain(self.segments.iter().map(|s| s.requires_version()))
|
.chain(self.segments.iter().map(|s| s.requires_version()))
|
||||||
.max()
|
.max()
|
||||||
.expect("Never fails")
|
.unwrap_or(ProtocolVersion::V1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Default for MediaPlaylistBuilder {
|
impl Default for MediaPlaylistBuilder {
|
||||||
|
@ -490,4 +490,10 @@ mod tests {
|
||||||
.is_ok()
|
.is_ok()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn empty_m3u8_parse_test() {
|
||||||
|
let m3u8 = "";
|
||||||
|
assert!(m3u8.parse::<MediaPlaylist>().is_err());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue