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

This commit is contained in:
nemunaire 2022-12-11 22:56:14 +01:00
parent 51d6e75f0c
commit 74c37c2fc9
1 changed files with 6 additions and 0 deletions

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)