Skip to content

Commit

Permalink
fix: set default values for extension flag to dont crash ignite (#4212)
Browse files Browse the repository at this point in the history
* set default values for extension flag to dont crash the app

* add changelog

* fix lint
  • Loading branch information
Pantani authored Jun 27, 2024
1 parent 0f311a6 commit 0aa948a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- [#4184](https://github.com/ignite/cli/pull/4184) Set custom `InitChainer` because of manually registered modules
- [#4198](https://github.com/ignite/cli/pull/4198) Set correct prefix overwriting in `buf.gen.pulsar.yaml`
- [#4199](https://github.com/ignite/cli/pull/4199) Set and seal SDK global config in `app/config.go`
- [#4212](https://github.com/ignite/cli/pull/4212) set default values for extension flag to dont crash ignite

## [`v28.4.0`](https://github.com/ignite/cli/releases/tag/v28.4.0)

Expand Down
14 changes: 14 additions & 0 deletions ignite/services/plugin/grpc/v1/interface_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ func newDefaultFlagValueError(typeName, value string) error {
}

func (f *Flag) exportToFlagSet(fs *pflag.FlagSet) error {
switch f.Type { //nolint:exhaustive
case Flag_TYPE_FLAG_BOOL,
Flag_TYPE_FLAG_INT,
Flag_TYPE_FLAG_INT64,
Flag_TYPE_FLAG_UINT,
Flag_TYPE_FLAG_UINT64:
if f.DefaultValue == "" {
f.DefaultValue = "0"
}
if f.Value == "" {
f.Value = "0"
}
}

switch f.Type {
case Flag_TYPE_FLAG_BOOL:
v, err := strconv.ParseBool(f.DefaultValue)
Expand Down

0 comments on commit 0aa948a

Please sign in to comment.