Просмотр исходного кода

Add missing error check in jsonpb's marshal implementation.

Otherwise invalid JSON can be produced.
Googler 9 лет назад
Родитель
Сommit
f43dfb5ff1
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      jsonpb/jsonpb.go

+ 3 - 1
jsonpb/jsonpb.go

@@ -382,7 +382,9 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
 				out.write(m.Indent)
 				out.write(m.Indent)
 			}
-			m.marshalValue(out, prop, sliceVal, indent+m.Indent)
+			if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil {
+				return err
+			}
 			comma = ","
 		}
 		if m.Indent != "" {