Panic if isHighlight is called with empty nick

Let's make sure callers never do this. We'd go into an infinite
loop previously.
This commit is contained in:
Simon Ser 2023-04-16 21:22:08 +02:00
parent 0548fdfa09
commit e5bce700a9
1 changed files with 4 additions and 0 deletions

4
irc.go
View File

@ -228,6 +228,10 @@ func isWordBoundary(r rune) bool {
}
func isHighlight(text, nick string) bool {
if len(nick) == 0 {
panic("isHighlight called with empty nick")
}
for {
i := strings.Index(text, nick)
if i < 0 {