From 610275ca1dfaf8ae0c4c87d47afc7ca73d8f0c3b Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 10 Feb 2021 02:21:15 +0100 Subject: [PATCH] Fix a nil pointer exception --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index d2aee3c..9e77a36 100644 --- a/main.go +++ b/main.go @@ -153,6 +153,7 @@ munits: func treatFrames(frames chan []byte, client influxdb2.Client) { first := true writeAPI := client.WriteAPIBlocking("", "teleinfo/autogen") +fframe: for { frame := <-frames @@ -182,6 +183,9 @@ func treatFrames(frames chan []byte, client influxdb2.Client) { } if key == "DATE" { + if horodate == nil { + continue fframe + } defaultHorodate = *horodate continue }