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:
parent
9dffff042e
commit
3f63b0c23c
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue