From 7633b426d17b18895d07ef0422d47008c2585b52 Mon Sep 17 00:00:00 2001 From: Vladimir Panarkin <[email protected]> Date: Fri, 22 Apr 2022 12:52:14 +0300 Subject: [PATCH] Swallow 'index out of range' error --- lib/combine_pdf/parser.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/combine_pdf/parser.rb b/lib/combine_pdf/parser.rb index 7ec0e5e..7cebd14 100644 --- a/lib/combine_pdf/parser.rb +++ b/lib/combine_pdf/parser.rb @@ -361,7 +361,11 @@ def _parse_ # advance by the publshed stream length (if any) old_pos = @scanner.pos if(out.last.is_a?(Hash) && out.last[:Length].is_a?(Integer) && out.last[:Length] > 2) - @scanner.pos += out.last[:Length] - 2 + begin + @scanner.pos += out.last[:Length] - 2 + rescue RangeError + # do nothing + end end # the following was dicarded because some PDF files didn't have an EOL marker as required