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:
parent
0548fdfa09
commit
e5bce700a9
4
irc.go
4
irc.go
@ -228,6 +228,10 @@ func isWordBoundary(r rune) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isHighlight(text, nick string) bool {
|
func isHighlight(text, nick string) bool {
|
||||||
|
if len(nick) == 0 {
|
||||||
|
panic("isHighlight called with empty nick")
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
i := strings.Index(text, nick)
|
i := strings.Index(text, nick)
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user