diff --git a/cmd/mop/main.go b/cmd/mop/main.go index 3c5ff72..7c64b77 100644 --- a/cmd/mop/main.go +++ b/cmd/mop/main.go @@ -143,4 +143,5 @@ func main() { profile := mop.NewProfile(*profileName) mainLoop(screen, profile) + profile.Save() } diff --git a/filter.go b/filter.go index 4cdf61b..f79decc 100644 --- a/filter.go +++ b/filter.go @@ -50,13 +50,21 @@ func (filter *Filter) Apply(stocks []Stock) []Stock { result, err := filter.profile.filterExpression.Evaluate(values) if err != nil { - panic(err) + // The filter isn't working, so reset to no filter. + filter.profile.Filter = "" + // Return an empty list. The next main loop cycle will + // show unfiltered. + return filteredStocks } truthy, ok := result.(bool) if !ok { - panic("Expression `" + filter.profile.Filter + "` should return a boolean value") + // The filter isn't working, so reset to no filter. + filter.profile.Filter = "" + // Return an empty list. The next main loop cycle will + // show unfiltered. + return filteredStocks } if truthy { diff --git a/profile.go b/profile.go index 6bb3c1e..ce393ed 100644 --- a/profile.go +++ b/profile.go @@ -142,5 +142,4 @@ func (profile *Profile) SetFilter(filter string) { } profile.Filter = filter - profile.Save() }