Skip to content

Roo::Base#each raises ArgumentError on empty sheets (last_row is nil) #639

@geremiasanti

Description

@geremiasanti

Hi, Same issue as #164 and #400, still happens on 3.0.0.

I've attached an example file, a valid xlsx, that causes the problem: empty_sheet.xlsx

reproduce with:

sheet = Roo::Spreadsheet.open("empty_sheet.xlsx", extension: ".xlsx").sheet(0)
sheet.first  #=> ArgumentError: comparison of Integer with nil
  failed

Happens because last_row is nil and 1.upto(nil) blows up in base.rb:286.

I think it should return zero instead (?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions