Skip to content

Commit

Permalink
fix: tolerate nil initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Jan 5, 2023
1 parent c740cd4 commit 880d6b5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package keeper
import (
"encoding/binary"
"encoding/json"
"fmt"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -32,7 +31,6 @@ type Keeper struct {
}

// NewKeeper constructs an upgrade Keeper which requires the following arguments:
// skipUpgradeHeights - map of heights to skip an upgrade
// storeKey - a store key with which to access upgrade's store
// cdc - the app-wide binary codec
// homePath - root directory of the application's config
Expand Down Expand Up @@ -327,7 +325,6 @@ func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan types.Plan) {
initializer := k.upgradeInitializer[plan.Name]
if initializer == nil {
ctx.Logger().Error("missing initializer to upgrade [" + plan.Name + "]")
return
}

err := initializer()
Expand Down Expand Up @@ -439,7 +436,7 @@ func (k Keeper) InitUpgraded(ctx sdk.Context) error {
if height < ctx.BlockHeight() {
f := k.upgradeInitializer[upgradeName]
if f == nil {
return fmt.Errorf("missing initializer for the upgrade [" + upgradeName + "]")
k.Logger(ctx).Error("missing initializer for the upgrade [" + upgradeName + "]")
}

err := f()
Expand Down

0 comments on commit 880d6b5

Please sign in to comment.