Don't modify nil getnetworkinfo result.

Since the result might not be set when the response does not contain one,
such as in the case when the command is not implemented by the server,
don't attempt to modify it until ensuring it exists.
This commit is contained in:
Dave Collins 2014-10-23 10:18:56 -05:00
parent a5b1a31e07
commit dd4763c726

View file

@ -580,7 +580,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
var res *GetNetworkInfoResult
err = json.Unmarshal(objmap["result"], &res)
if err == nil {
if res.LocalAddresses == nil {
if res != nil && res.LocalAddresses == nil {
res.LocalAddresses = []LocalAddressesResult{}
}
result.Result = res