Skip to content

Commit

Permalink
fix: return nil when HeaderTable.Get does not find anything
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-stebbins-dailypay committed Sep 3, 2024
1 parent ae1ad2e commit 183b82e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions datatable.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ type HeaderTable struct {
}

// Get returns the cell at the provided row offset (skipping the header row)
// and column name (as indicated in the header).
// and column name (as indicated in the header). If the column name is not
// found, nil is returned.
func (h *HeaderTable) Get(row int, col string) *Cell {
return h.DataTable.Cell(row+1, h.headers[col])
if v, ok := h.headers[col]; !ok {
return nil
} else {
return h.DataTable.Cell(row+1, v)
}
}

// NumRows returns the number of rows in the table (excluding the header row).
Expand Down

0 comments on commit 183b82e

Please sign in to comment.