diff options
author | Veeti Paananen <veeti.paananen@rojekti.fi> | 2014-05-13 05:57:38 +0300 |
---|---|---|
committer | Veeti Paananen <veeti.paananen@rojekti.fi> | 2014-05-13 05:57:38 +0300 |
commit | 85d5449b3cfe73d894a57718b0eeec57084022da (patch) | |
tree | d4187bed96906cc42b69d989cb790e2bafdf8c9d /cmd | |
parent | 532b576fd59fd60d556f62bdbab70b3fbb6e54e0 (diff) |
Return a blank array instead of null if there are no repositories
Fixes a bug where it's impossible to add repositories in the web
interface if none are defined.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/syncthing/config.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/syncthing/config.go b/cmd/syncthing/config.go index 7bd833dcbe..596f3f1401 100644 --- a/cmd/syncthing/config.go +++ b/cmd/syncthing/config.go @@ -171,6 +171,11 @@ func readConfigXML(rd io.Reader, myID string) (Configuration, error) { cfg.Options.ListenAddress = uniqueStrings(cfg.Options.ListenAddress) + // Initialize an empty slice for repositories if the config has none + if cfg.Repositories == nil { + cfg.Repositories = []RepositoryConfiguration{} + } + // Check for missing, bad or duplicate repository ID:s var seenRepos = map[string]*RepositoryConfiguration{} for i := range cfg.Repositories { |