Avoid out of bounds exception if checksum is ok but data is crap
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
nemunaire 2022-12-11 22:56:14 +01:00
parent 51d6e75f0c
commit 74c37c2fc9

View File

@ -3,6 +3,7 @@ package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
@ -155,6 +156,11 @@ func treatLine(line []byte, legacyMode bool) (key string, horodate *time.Time, d
fields := bytes.Fields(line)
if len(fields) < 2 {
err = fmt.Errorf("Invalid number of fields in line")
return
}
key = string(fields[0])
horodate, err = getHorodate(&fields)