Fixed error when adding data to a datapoint without triggers.

This commit is contained in:
Magnus Åhall 2024-06-27 10:33:26 +02:00
parent 22f6b6a413
commit 3109124a88

View File

@ -101,6 +101,11 @@ func TriggersRetrieveByDatapoint(datapointName string) (triggers []Trigger, err
return return
} }
// no triggers found for this datapoint.
if data == nil {
return
}
err = json.Unmarshal(data, &triggers) err = json.Unmarshal(data, &triggers)
if err != nil { if err != nil {
err = werr.Wrap(err).WithData(datapointName) err = werr.Wrap(err).WithData(datapointName)