infused / dbf

DBF is a small, fast Ruby library for reading dBase, xBase, Clipper, and FoxPro database files.
http://rdoc.info/projects/infused/dbf
MIT License
262 stars 88 forks source link

no implicit conversion of nil into String #99

Closed doconnor-clintel closed 6 months ago

doconnor-clintel commented 11 months ago

Basically the same kind of issue as #90 and https://github.com/infused/dbf/pull/91

The comment on that PR is:

As of 4.1.3 a DBF::NoColumnsDefined error will be raised when attempting to read records if no columns are defined

However, we see:

no implicit conversion of nil into String
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/record.rb:11:in `initialize'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/record.rb:11:in `new'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/record.rb:11:in `initialize'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/table.rb:191:in `new'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/table.rb:191:in `record'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/table.rb:120:in `block in each'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/table.rb:120:in `times'
/var/www/careright/shared/bundle/ruby/2.6.0/gems/dbf-4.2.4/lib/dbf/table.rb:120:in `each'
/var/www/careright/releases/20231212045615/app/models/lookup.rb:506:in `import!'

Ideally, instantiating a record with data: nil would raise an argument error or similar, and reading a table + trying to instantiate a record wouldn't occur if it wasn't valid OR it raises a meaningful exception.

DBF Data: Can't attach here unfortunately (licencing). I suspect we're managing to pass in nulls/invalid data/etc.