From 5d90f7a92094f00a40f129ebc6502ef51c97ef35 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 22 Jan 2013 14:54:27 -0500 Subject: [PATCH] Check errors --- plugins/dice.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/dice.go b/plugins/dice.go index 98fd477..a3898cc 100644 --- a/plugins/dice.go +++ b/plugins/dice.go @@ -45,8 +45,14 @@ func (p *DicePlugin) Message(message bot.Message) bool { if len(dice) == 2 { // We actually have a die roll. - nDice, _ := strconv.Atoi(dice[0]) - sides, _ := strconv.Atoi(dice[1]) + nDice, err := strconv.Atoi(dice[0]) + if err != nil { + return false + } + sides, err := strconv.Atoi(dice[1]) + if err != nil { + return false + } rolls := fmt.Sprintf("%s, you rolled: ", message.User.Name) for i := 0; i < nDice; i++ {