Skip to content

Commit

Permalink
Prevent NPE in CSV diff rendering when column removed (#17018) (#17377)
Browse files Browse the repository at this point in the history
Backport of #17018

Fixes #16837 if a column is deleted.
  • Loading branch information
richmahn authored Oct 20, 2021
1 parent 79f0b1a commit befb6be
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 136 deletions.
3 changes: 3 additions & 0 deletions modules/csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func CreateReaderAndGuessDelimiter(rd io.Reader) (*stdcsv.Reader, error) {
var data = make([]byte, 1e4)
size, err := rd.Read(data)
if err != nil {
if err == io.EOF {
return CreateReader(bytes.NewReader([]byte{}), rune(',')), nil
}
return nil, err
}

Expand Down
Loading

0 comments on commit befb6be

Please sign in to comment.