From cf4e9f829a1e30c6f4d9d2e2713fb1221f095229 Mon Sep 17 00:00:00 2001 From: tj Date: Sun, 21 Nov 2010 21:20:18 +0100 Subject: [PATCH] Crashfix on empty privmsg --- irc_callback.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_callback.go b/irc_callback.go index fead866..d68f92b 100644 --- a/irc_callback.go +++ b/irc_callback.go @@ -31,7 +31,7 @@ func (irc *IRCConnection) ReplaceCallback(eventcode string, i int, callback func } 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 if i := strings.LastIndex(event.Message, "\x01"); i > -1 { event.Message = event.Message[1:i]