kunt

golang IRC bot
git clone git://git.2f30.org/kunt
Log | Files | Refs | LICENSE

commit 9153f2825a66aea5b9461a89bfae26bee52d793e
parent 02d93d181350104698f43f8bbf4712ea689d8ad6
Author: dsp <dsp@2f30.org>
Date:   Thu, 18 Jul 2013 13:23:12 +0100

Fixed a bug in hangman. When in mainLoop we were checking msg.Args without correct bound checking

Diffstat:
Msrc/games/hangman.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/games/hangman.go b/src/games/hangman.go @@ -95,6 +95,9 @@ func hangmanWaitGoal(cs *hangmanState) { func hangmanMainLoop(cs *hangmanState) { cs.ictx.Privmsg(cs.channame, cs.String()) for msg := range *cs.gchan { + if len(msg.Args) < 2 { //this was a bug when kunt was getting NICK xxxx Args[1] was nil + continue + } msg.Args[1] = strings.TrimSpace(msg.Args[1]) if msg.Args[0] != cs.botname { if cs.lives < 1 {