Check that server is nil before calling peers count

On logout happens sometimes that `PeersCount` is called when the server
has been removed.
This commit adds a guard to make sure that the server is not nil when
calling `PeersCount`.
This commit is contained in:
Andrea Maria Piana 2020-11-02 16:50:05 +01:00
parent 9dffff042e
commit 3f63b0c23c
2 changed files with 4 additions and 1 deletions

View File

@ -1 +1 @@
0.62.17
0.62.18

View File

@ -101,5 +101,8 @@ func (w *gethNodeWrapper) RemovePeer(url string) error {
}
func (w *gethNodeWrapper) PeersCount() int {
if w.stack.Server() == nil {
return 0
}
return len(w.stack.Server().Peers())
}