From 8fc6e685111ff1168af533eb2214b0de2796a4e3 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Thu, 5 Jul 2018 18:24:00 -0700 Subject: [PATCH] stake/client: Fix panic on if validator doesn't exist Closes #1505 --- CHANGELOG.md | 1 + x/stake/client/cli/query.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9672c5e5..57bea2f9a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ BUG FIXES * \#1258 - printing big.rat's can no longer overflow int64 * \#887 - limit the size of rationals that can be passed in from user input * \#1461 - CLI tests now no longer reset your local environment data +* \#1505 - `gaiacli stake validator` no longer panics if validator doesn't exist ## 0.19.0 diff --git a/x/stake/client/cli/query.go b/x/stake/client/cli/query.go index 82149a2fa5..30f833c020 100644 --- a/x/stake/client/cli/query.go +++ b/x/stake/client/cli/query.go @@ -31,8 +31,9 @@ func GetCmdQueryValidator(storeName string, cdc *wire.Codec) *cobra.Command { res, err := ctx.QueryStore(key, storeName) if err != nil { return err + } else if len(res) == 0 { + return fmt.Errorf("No validator found with address %s", args[0]) } - validator := types.MustUnmarshalValidator(cdc, addr, res) switch viper.Get(cli.OutputFlag) {