Crashfix on empty privmsg

This commit is contained in:
tj 2010-11-21 21:20:18 +01:00
parent deae8abc23
commit cf4e9f829a

View File

@ -31,7 +31,7 @@ func (irc *IRCConnection) ReplaceCallback(eventcode string, i int, callback func
} }
func (irc *IRCConnection) RunCallbacks(event *IRCEvent) { func (irc *IRCConnection) RunCallbacks(event *IRCEvent) {
if event.Code == "PRIVMSG" && event.Message[0] == '\x01' { if event.Code == "PRIVMSG" && len(event.Message) > 0 && event.Message[0] == '\x01' {
event.Code = "CTCP" //Unknown CTCP event.Code = "CTCP" //Unknown CTCP
if i := strings.LastIndex(event.Message, "\x01"); i > -1 { if i := strings.LastIndex(event.Message, "\x01"); i > -1 {
event.Message = event.Message[1:i] event.Message = event.Message[1:i]