mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-26 05:17:19 +00:00
Always return something valid
This commit is contained in:
parent
c44f4f32fe
commit
b368549fd5
@ -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…
Reference in New Issue
Block a user