Skip to content

Commit

Permalink
fix: Add defer and recover in main function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom5521 committed Jun 15, 2024
1 parent 510b05e commit 55775a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import (
var Settings conf.Preferences

func main() {
defer func() {
if r := recover(); r != nil {
color.Errorln(r)
}
}()

// Initialize variables
err := settings.Load()
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions settings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ var Settings conf.Preferences

func Load() (err error) {
Settings, err = conf.New("fsize")
if err != nil {
return err
}
return nil
return
}

func Parse(optionsArgs []string) error {
Expand Down

0 comments on commit 55775a4

Please sign in to comment.