don't allocate memory in case return value is nil

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-06-28 16:26:11 -04:00 committed by Jakub
parent 742a6766b4
commit b328dc3655

View File

@ -17,7 +17,7 @@ func newClient(url string) (*StatusGoClient, error) {
}
func (c *StatusGoClient) getPeers() ([]Peer, error) {
peers := make([]Peer, 0)
var peers []Peer
err := c.rpcClient.Call(&peers, "admin_peers")
if err != nil {
return nil, err