Skip to content

Commit 91b53f2

Browse files
haastedalexanderbez
authored andcommitted
Merge PR #4919: Fix GetConfirmation User Input Bug
1 parent 70d50a6 commit 91b53f2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ longer panics if the store to load contains substores that we didn't explicitly
7878
* (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator`
7979
* (keys) Fix ledger custom coin type support bug
8080
* (simulation) [\#4912](https://github.com/cosmos/cosmos-sdk/issues/4912) Fix SimApp ModuleAccountAddrs to properly return black listed addresses for bank keeper initialization
81+
* (cli) [\#4919](https://github.com/cosmos/cosmos-sdk/pull/4919) Don't crash cli if user doesn't answer y/n confirmation request
8182

8283
## [v0.36.0] - 2019-08-13
8384

client/input/input.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ func GetConfirmation(prompt string, buf *bufio.Reader) (bool, error) {
7474
return false, err
7575
}
7676

77-
response = strings.ToLower(strings.TrimSpace(response))
77+
response = strings.TrimSpace(response)
78+
if len(response) == 0 {
79+
return false, nil
80+
}
81+
82+
response = strings.ToLower(response)
7883
if response[0] == 'y' {
7984
return true, nil
8085
}

0 commit comments

Comments
 (0)