Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def parse
@start = Timestamp.new $1
@end = Timestamp.new $2
@style = Hash[$3.strip.split(" ").map{|s| s.split(":").map(&:strip) }]
else
return
end
@text = lines[1..-1].join("\n")
end
Expand Down
6 changes: 6 additions & 0 deletions tests/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,10 @@ def test_invalid_cue
webvtt = WebVTT.convert_from_srt("tests/subtitles/invalid_cue.srt")
assert_equal 1, webvtt.cues.size
end

def test_invalid_cue_time
cue_string = open("tests/subtitles/invalid_cue_time.srt").read
cue = WebVTT::Cue.parse(cue_string)
assert_nil cue.text
end
end
3 changes: 3 additions & 0 deletions tests/subtitles/invalid_cue_time.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
9999
00:00:0,500 --> 00:00:2,00
<font color="#ffff00" size=14>www.tvsubtitles.net</font>