From 434ecdac6bbda74a2de0f7a80144a2c6dac0c8a4 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 22 Sep 2014 14:03:58 +0200 Subject: [PATCH] LocalVersion is unavailable until after AddRepo (fixes #154) --- cmd/syncthing/main.go | 4 +--- model/model.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 6f1e252ef..181ac507f 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -431,8 +431,8 @@ nextRepo: if repo.Invalid != "" { continue } - repo.Directory = expandTilde(repo.Directory) + m.AddRepo(repo) fi, err := os.Stat(repo.Directory) if m.LocalVersion(repo.ID) > 0 { @@ -458,8 +458,6 @@ nextRepo: cfg.Repositories[i].Invalid = err.Error() continue nextRepo } - - m.AddRepo(repo) } // GUI diff --git a/model/model.go b/model/model.go index ecef5152d..16c84963c 100644 --- a/model/model.go +++ b/model/model.go @@ -1044,7 +1044,7 @@ func (m *Model) LocalVersion(repo string) uint64 { fs, ok := m.repoFiles[repo] if !ok { - return 0 + panic("bug: LocalVersion called for nonexistent repo " + repo) } ver := fs.LocalVersion(protocol.LocalNodeID)