Skip to content

Commit

Permalink
guard against nil once
Browse files Browse the repository at this point in the history
  • Loading branch information
csucu committed Aug 30, 2023
1 parent 3946aba commit 95c6057
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,10 @@ func (p *parser) fireMatch(t *token, r Result, explanation string, ttl time.Dura
}

func (p *parser) fireFirstMatch(r Result, e error) {
if p.listener == nil {
if p.listener == nil || p.fireFirstMatchOnce == nil {
return
}

p.fireFirstMatchOnce.Do(func() {
p.listener.FirstMatch(r, e)
})
Expand Down

0 comments on commit 95c6057

Please sign in to comment.