diff --git a/draft/polling.go b/draft/polling.go index 7034356..ed65d65 100644 --- a/draft/polling.go +++ b/draft/polling.go @@ -153,6 +153,10 @@ func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) { func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) { lst := make([]Polled, 0, len(p.items)) + if len(p.items) == 0 { + return lst, nil + } + var ctx *Context for _, soc := range p.socks { if !soc.opened { diff --git a/polling.go b/polling.go index 7034356..ed65d65 100644 --- a/polling.go +++ b/polling.go @@ -153,6 +153,10 @@ func (p *Poller) PollAll(timeout time.Duration) ([]Polled, error) { func (p *Poller) poll(timeout time.Duration, all bool) ([]Polled, error) { lst := make([]Polled, 0, len(p.items)) + if len(p.items) == 0 { + return lst, nil + } + var ctx *Context for _, soc := range p.socks { if !soc.opened {