Be more robust about nil pointers in protobuf

While not strictly correct, it can easily happen that proto messages
are created that use nil pointers instead of pointers in empty strings
to denote an empty string.

Signed-off-by: beorn7 <beorn@soundcloud.com>
This commit is contained in:
beorn7 2018-05-29 17:51:55 +02:00
parent c51dc758d4
commit 1b56b5c497
1 changed files with 2 additions and 2 deletions

View File

@ -727,8 +727,8 @@ func checkMetricConsistency(
} }
for _, labelPair := range dtoMetric.GetLabel() { for _, labelPair := range dtoMetric.GetLabel() {
if !utf8.ValidString(*labelPair.Value) { if !utf8.ValidString(labelPair.GetValue()) {
return fmt.Errorf("collected metric's label %s is not utf8: %#v", *labelPair.Name, *labelPair.Value) return fmt.Errorf("collected metric's label %s is not utf8: %#v", labelPair.GetName(), labelPair.GetValue())
} }
} }