From 85d5449b3cfe73d894a57718b0eeec57084022da Mon Sep 17 00:00:00 2001 From: Veeti Paananen Date: Tue, 13 May 2014 05:57:38 +0300 Subject: [PATCH] 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. --- cmd/syncthing/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/syncthing/config.go b/cmd/syncthing/config.go index 7bd833dcb..596f3f140 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 {