defensive coce

This commit is contained in:
A.Unger
2020-01-31 14:41:29 +01:00
parent 6b4c3f2098
commit 949b67bec6
+5 -3
View File
@@ -42,9 +42,11 @@ func (s Service) Get(c context.Context, req *proto.Query, res *proto.Record) err
// TODO deal with this
}
r := &proto.Payload{}
json.Unmarshal(contents[0].Value, r)
if len(contents) > 0 {
r := &proto.Payload{}
json.Unmarshal(contents[0].Value, r)
res.Payload = r
}
res.Payload = r
return nil
}