Prevent index out of bunds error

I'm reusing this driver for disque client... and get index out of bounds error because there really are just 2 items in array not 3.
This commit is contained in:
Miha Vrhovnik 2020-08-05 08:50:08 +02:00 committed by Miha Vrhovnik
parent 3fbf7df014
commit 40f80e8913
1 changed files with 3 additions and 2 deletions

View File

@ -44,9 +44,10 @@ func (it *ScanIterator) Next(ctx context.Context) bool {
}
// Fetch next page.
if it.cmd.args[0] == "scan" {
switch it.cmd.args[0] {
case "scan", "qscan":
it.cmd.args[1] = it.cmd.cursor
} else {
default:
it.cmd.args[2] = it.cmd.cursor
}