Skip to content

Commit

Permalink
Return error if default chart range is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Aug 22, 2021
1 parent 1c14561 commit ac93b8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cointop/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ func (ct *Cointop) loadDefaultChartRangeFromConfig() error {
ct.debuglog("loadDefaultChartRangeFromConfig()")
if defaultChartRange, ok := ct.config.DefaultChartRange.(string); ok {
// validate configured value
_, present := ct.chartRangesMap[defaultChartRange]
if !present {
defaultChartRange = DefaultChartRange
_, ok := ct.chartRangesMap[defaultChartRange]
if !ok {
return fmt.Errorf("invalid default chart range %q. Valid ranges are: %s", defaultChartRange, strings.Join(ChartRanges(), ","))
}
ct.State.defaultChartRange = defaultChartRange
ct.State.selectedChartRange = defaultChartRange
Expand Down

0 comments on commit ac93b8f

Please sign in to comment.