Skip to content

Commit

Permalink
Merge pull request #1 from sternhenri/master
Browse files Browse the repository at this point in the history
Fix index miss if answer <= 0
  • Loading branch information
Alessio Pracchia authored Jun 7, 2017
2 parents c424f9a + dfeb9ef commit 620e305
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quest.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (q *Question) wait() error {
// multiple choice
if q.choices {
choice, err := strconv.ParseInt(q.response, 10, 64)
if err != nil || int(choice) > len(q.Alternatives) {
if err != nil || int(choice) > len(q.Alternatives) || int(choice) < 1 {
return errors.New("out of range")
}
q.value = q.Alternatives[choice-1].Response
Expand Down

0 comments on commit 620e305

Please sign in to comment.