This commit is contained in:
Jeromy 2015-02-13 07:47:51 +00:00
parent d2544da530
commit 9c83bd0959
1 changed files with 5 additions and 3 deletions

View File

@ -154,9 +154,11 @@ func (pi *PeerInfo) UnmarshalJSON(b []byte) error {
return err
}
pi.ID = pid
addrs := data["Addrs"].([]interface{})
for _, a := range addrs {
pi.Addrs = append(pi.Addrs, ma.StringCast(a.(string)))
addrs, ok := data["Addrs"].([]interface{})
if ok {
for _, a := range addrs {
pi.Addrs = append(pi.Addrs, ma.StringCast(a.(string)))
}
}
return nil
}