lib/hexapdf/parser.rb in hexapdf-0.24.0 vs lib/hexapdf/parser.rb in hexapdf-0.24.1
- old
+ new
@@ -170,10 +170,10 @@
else
0
end
@tokenizer.pos = pos + length rescue pos
- tok = @tokenizer.next_token
+ tok = @tokenizer.next_token rescue nil
unless tok.kind_of?(Tokenizer::Token) && tok == 'endstream'
maybe_raise("Invalid stream length, keyword endstream not found", pos: @tokenizer.pos)
@tokenizer.pos = pos
if @tokenizer.scan_until(/(?=\n?endstream)/)
length = @tokenizer.pos - pos