From f40140283a2cf8731f768efb14e5843f8eee3738 Mon Sep 17 00:00:00 2001 From: davtoro <35560260+davtoro@users.noreply.github.com> Date: Sat, 13 Apr 2019 15:25:19 +0200 Subject: [PATCH] check if peer id exists --- tracker/peer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tracker/peer.go b/tracker/peer.go index 44d61e82..6f13c569 100644 --- a/tracker/peer.go +++ b/tracker/peer.go @@ -15,7 +15,9 @@ type Peer struct { // Set from the non-compact form in BEP 3. func (p *Peer) fromDictInterface(d map[string]interface{}) { p.IP = net.ParseIP(d["ip"].(string)) - p.ID = []byte(d["peer id"].(string)) + if _, ok := d["peer id"]; ok { + p.ID = []byte(d["peer id"].(string)) + } p.Port = int(d["port"].(int64)) }