yob/pdf-reader

Error: undefined method '[]=' for nil:NilClass

pbalaban opened this issue · 1 comments

First of all, thanks for creating this awesome gem!
I'm start searching inside PDF files and it helps me a lot.

Some of PDF files can not be processed correctly and the lib raises undefined method '[]=' for nil:NilClass error.
The issue is reproducible on version 2.4.2 with the attached file and the code below:

[3] pry(main)> PDF::Reader.new("1397476_1_A.pdf").pages.first.text
NoMethodError: undefined method `[]=' for nil:NilClass
from /home/peter/.rvm/gems/ruby-2.6.3@lytics/gems/pdf-reader-2.4.2/lib/pdf/reader/page_layout.rb:121:in `local_string_insert'

I tried to downgrade the version and it seems that issue appears somewhere between 2.0.0 and 2.1.0

yob commented

Thanks for the clear report and sample file - I've added a fix and spec in #347.