From c3e04178588a71c3888a87fd82db6d36d5d855aa Mon Sep 17 00:00:00 2001 From: Artur Shellunts Date: Sat, 4 Feb 2023 09:24:02 +0100 Subject: [PATCH] Remove redundant check for null pointer Pointer is already checked earlier in the function --- AUTHORS.txt | 1 + agent.go | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index d6ff714..b41ff51 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -8,6 +8,7 @@ Adam Kiss adwpc Aleksandr Razumov Antoine Baché +Artur Shellunts Assad Obaid Atsushi Watanabe backkem diff --git a/agent.go b/agent.go index 0d966af..70d4908 100644 --- a/agent.go +++ b/agent.go @@ -588,14 +588,12 @@ func (a *Agent) setSelectedPair(p *CandidatePair) { a.updateConnectionState(ConnectionStateConnected) // Notify when the selected pair changes - if p != nil { - a.afterRun(func(ctx context.Context) { - select { - case a.chanCandidatePair <- p: - case <-ctx.Done(): - } - }) - } + a.afterRun(func(ctx context.Context) { + select { + case a.chanCandidatePair <- p: + case <-ctx.Done(): + } + }) // Signal connected a.onConnectedOnce.Do(func() { close(a.onConnected) })