Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return nil when HeaderTable.Get does not find a corresponding header #36

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading