Always return something valid

pull/150/head
obscuren 10 years ago
parent c44f4f32fe
commit b368549fd5
  1. 5
      ethpipe/js_pipe.go

@ -276,6 +276,11 @@ func (self *JSFilter) MessagesToJson(messages ethstate.Messages) string {
msgs = append(msgs, NewJSMessage(m)) msgs = append(msgs, NewJSMessage(m))
} }
// Return an empty array instead of "null"
if len(msgs) == 0 {
return "[]"
}
b, err := json.Marshal(msgs) b, err := json.Marshal(msgs)
if err != nil { if err != nil {
return "{\"error\":" + err.Error() + "}" return "{\"error\":" + err.Error() + "}"

Loading…
Cancel
Save