Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit aad74d9

Browse files
don't panic on invalid json config
1 parent d7bce9f commit aad74d9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/config/config.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func customOptsAsToml(path string) ([]byte, error) {
8585
var tmpCfg Config
8686
err = json.Unmarshal(oldCfg, &tmpCfg)
8787
if err != nil {
88-
return nil, fmt.Errorf("invalid open old config: %w", err)
88+
return nil, fmt.Errorf("invalid old config: %w", err)
8989
}
9090
tmpCfg2 := ConversionConfig{
9191
CustomPlaybackOptions: tmpCfg.CustomPlaybackOptions,
@@ -110,10 +110,7 @@ func LoadConfig() (Config, error) {
110110
if _, err = os.Stat(path.Join(p, configName)); os.IsNotExist(err) {
111111
cfgData := defaultConfig
112112
customOptsToml, err := customOptsAsToml(p)
113-
if err != nil {
114-
fmt.Println("failed to convert custom options: " + err.Error())
115-
panic(err)
116-
} else {
113+
if err == nil {
117114
cfgData = append(cfgData, 0x0A) // newline
118115
cfgData = append(cfgData, customOptsToml...) // add existing custom opts
119116
}

0 commit comments

Comments
 (0)