Fix AskStubber erroring out when there are more asks than stubs

This commit is contained in:
Mislav Marohnić 2020-09-23 19:55:11 +02:00
parent e2efc0b8a3
commit eee32f324c

View file

@ -26,7 +26,7 @@ func InitAskStubber() (*AskStubber, func()) {
as.AskOnes = append(as.AskOnes, &p)
count := as.OneCount
as.OneCount += 1
if count > len(as.StubOnes) {
if count >= len(as.StubOnes) {
panic(fmt.Sprintf("more asks than stubs. most recent call: %v", p))
}
stubbedPrompt := as.StubOnes[count]