roo-rb / roo

Roo provides an interface to spreadsheets of several sorts.
MIT License
2.78k stars 502 forks source link

NoMethodError: undefined method `gsub' for nil:NilClass for links in csv formatter #569

Open shcyiza opened 2 years ago

shcyiza commented 2 years ago

Issue

While parsing a file converting xlsx file to CSV I came accros this error: NoMethodError: undefined method 'gsub' for nil:NilClass /gems/ruby/2.7.0/gems/roo-2.8.3/lib/roo/formatters/csv.rb:77:in 'cell_to_csv' I cannot share the file for privacy reason unfortunately but it looks like it's an easy fix.

It seems that unlike the formatter for strings, the links part of the code is not nil safe. location: /lib/roo/formatters/csv.rb:77:in `cell_to_csv' change proposal here: https://github.com/roo-rb/roo/compare/master...shcyiza:patch-1

System configuration

Roo version: 2.8.3

Ruby version: 2.7.2p137