Ver código fonte

Add missing error check in jsonpb's marshal implementation.

Otherwise invalid JSON can be produced.
Googler 9 anos atrás
pai
commit
f43dfb5ff1
1 arquivos alterados com 3 adições e 1 exclusões
  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)
 				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 = ","
 			comma = ","
 		}
 		}
 		if m.Indent != "" {
 		if m.Indent != "" {