Skip to content

Commit

Permalink
fix: add nil checks for controller and host keeper services (backport c…
Browse files Browse the repository at this point in the history
…osmos#2308) (cosmos#2313)

* fix: add nil checks for controller and host keeper services (cosmos#2308)

closes: #XXXX

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes

(cherry picked from commit 888c4a0)

* fix merge conflicts

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
  • Loading branch information
2 people authored and dudong2 committed Jan 19, 2023
1 parent 74ae18c commit ab6dec6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions modules/apps/27-interchain-accounts/module.go
Expand Up @@ -69,10 +69,13 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the interchain accounts module.
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := controllertypes.RegisterQueryHandlerClient(context.Background(), mux, controllertypes.NewQueryClient(clientCtx)); err != nil {
err := controllertypes.RegisterQueryHandlerClient(context.Background(), mux, controllertypes.NewQueryClient(clientCtx))
if err != nil {
panic(err)
}
if err := hosttypes.RegisterQueryHandlerClient(context.Background(), mux, hosttypes.NewQueryClient(clientCtx)); err != nil {

err = hosttypes.RegisterQueryHandlerClient(context.Background(), mux, hosttypes.NewQueryClient(clientCtx))
if err != nil {
panic(err)
}
}
Expand Down Expand Up @@ -145,8 +148,13 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd

// RegisterServices registers module services
func (am AppModule) RegisterServices(cfg module.Configurator) {
controllertypes.RegisterQueryServer(cfg.QueryServer(), am.controllerKeeper)
hosttypes.RegisterQueryServer(cfg.QueryServer(), am.hostKeeper)
if am.controllerKeeper != nil {
controllertypes.RegisterQueryServer(cfg.QueryServer(), am.controllerKeeper)
}

if am.hostKeeper != nil {
hosttypes.RegisterQueryServer(cfg.QueryServer(), am.hostKeeper)
}
}

// InitGenesis performs genesis initialization for the interchain accounts module.
Expand Down

0 comments on commit ab6dec6

Please sign in to comment.