1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-11-10 17:31:02 +00:00

Fix the unexpected panic reported by #2

This commit is contained in:
Takeru Ohta 2018-10-11 00:35:24 +09:00
parent 807b73a701
commit 3122949384

View file

@ -175,7 +175,7 @@ impl MediaPlaylistBuilder {
.chain(self.end_list_tag.iter().map(|t| t.requires_version()))
.chain(self.segments.iter().map(|s| s.requires_version()))
.max()
.expect("Never fails")
.unwrap_or(ProtocolVersion::V1)
}
}
impl Default for MediaPlaylistBuilder {
@ -490,4 +490,10 @@ mod tests {
.is_ok()
);
}
#[test]
fn empty_m3u8_parse_test() {
let m3u8 = "";
assert!(m3u8.parse::<MediaPlaylist>().is_err());
}
}