Title.rb line 30 error: undefined method `[]' for nil:NilClass
jgrossi opened this issue · 1 comments
jgrossi commented
Hi!
I'm using pdf-extract
to get some papers data and everything was working well, but for some PDF papers I'm receiving this error message: undefined method '[]' for nil:NilClass
on line 30
of the file lib/analysis/titles.rb
, like above:
titles.sort_by! { |r| -r[:line_height] }
tallest_line = titles.first[:line_height] # this is line 30 --> titles is an empty array []
title_slop = tallest_line - (tallest_line * pdf.settings[:title_slop])
titles.reject! { |r| r[:line_height] < title_slop }
Any idea how to solve this?
Thanks!