diff --git a/config.go b/config.go index fbe746f..516bfa3 100644 --- a/config.go +++ b/config.go @@ -21,7 +21,7 @@ const configFile = "config.toml" func initializeConfigIfNot() { log.Println("Checking if config needs to be initialized") - conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true} // if you're a package maintainer and you mess with this, we have a problem. + conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true, LastUsedInput: nil} // if you're a package maintainer and you mess with this, we have a problem. // Unless you set -tags release on the build the updater is *not* compiled in any. DO NOT MESS WITH THIS! // This isn't and never was the proper location to disable the updater. diff --git a/main.go b/main.go index 142b850..6e9b8b6 100644 --- a/main.go +++ b/main.go @@ -246,9 +246,12 @@ func getSourcesWithPreSelectedInput(ctx *ntcontext) []input { inputs := getSources(ctx.paClient) preselectedInputId := ctx.config.LastUsedInput inputExists := false - for _, input := range inputs { - inputExists = inputExists || input.ID == *preselectedInputId + if preselectedInputId != nil { + for _, input := range inputs { + inputExists = inputExists || input.ID == *preselectedInputId + } } + if !inputExists { defaultSource, err := getDefaultSourceID(ctx.paClient) if err != nil {