mirror of
https://github.com/nxshock/csv2db.git
synced 2024-11-27 03:31:00 +05:00
Prevent out of bounds when access to empty comma parameter
This commit is contained in:
parent
c4f18766cb
commit
06139693c6
2
main.go
2
main.go
@ -135,7 +135,7 @@ func processReader(c *cli.Context, r io.Reader) error {
|
|||||||
reader.TrimLeadingSpace = false
|
reader.TrimLeadingSpace = false
|
||||||
reader.FieldsPerRecord = len(c.String("fields"))
|
reader.FieldsPerRecord = len(c.String("fields"))
|
||||||
|
|
||||||
if []rune(c.String("comma"))[0] == 't' {
|
if runes := []rune(c.String("comma")); len(runes) > 0 && runes[0] == 't' {
|
||||||
reader.Comma = '\t'
|
reader.Comma = '\t'
|
||||||
} else {
|
} else {
|
||||||
reader.Comma = []rune(c.String("comma"))[0]
|
reader.Comma = []rune(c.String("comma"))[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user