boazsegev / combine_pdf

A Pure ruby library to merge PDF files, number pages and maybe more...
MIT License
735 stars 157 forks source link

[0.2.25] NoMethodError undefined method `+' for nil:NilClass #74

Closed bartoszkopinski closed 8 years ago

bartoszkopinski commented 8 years ago

I'm getting this error after upgrading from 0.2.23 to 0.2.25.

This is the backtrace:

NoMethodError undefined method `+' for nil:NilClass
vendor/bundle/ruby/2.3.0/gems/combine_pdf-0.2.25/lib/combine_pdf/pdf_protected.rb:299:in `merge_outlines': undefined method `+' for nil:NilClass (NoMethodError)
from vendor/bundle/ruby/2.3.0/gems/combine_pdf-0.2.25/lib/combine_pdf/pdf_public.rb:302:in `insert'
from vendor/bundle/ruby/2.3.0/gems/combine_pdf-0.2.25/lib/combine_pdf/pdf_public.rb:274:in `<<'

Code:

pdf = uploader.retrieve_file_content(s3_filename)
pdf_files[key] ||= CombinePDF.new
pdf_files[key] << CombinePDF.parse(pdf) # Exception

Let me know if you need more details.

boazsegev commented 8 years ago

Hi Bartosz,

Thank you for opening this issue.

I think the issue might have been fixed in version 0.2.27.... could you review?

(we had a few busy days rewriting some of the core algorithms to minimize recursion and rolling out the outline merging feature).

If the issue persists, could you share with me an example file. The library is working on all the test files I've got. Reviewing the file will both help me track down the cause and test future versions.

Thanks! Bo.

bartoszkopinski commented 8 years ago

@boazsegev Thanks for the reply. You're right, it looks like it's been fixed. I didn't notice the latest version, sorry.

bartoszkopinski commented 8 years ago

BTW if you want, you could probably mark this version as "yanked" in rubygems.

boazsegev commented 8 years ago

Thanks for the tip. I marked it as "yanked", however I must admit I usually avoid this (all teeny versions are bug fixes and non API breaking updates, by this logic, all teeny updates require yanking the previous teeny version)... however, you're right, it's been a busy week :-)