Pārlūkot izejas kodu

Folders queried by the REST interface might not exist in the model (fixes #823)

Jakob Borg 11 gadi atpakaļ
vecāks
revīzija
5656be5206
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      internal/model/model.go

+ 3 - 1
internal/model/model.go

@@ -1216,7 +1216,9 @@ func (m *Model) CurrentLocalVersion(folder string) uint64 {
 
 	fs, ok := m.folderFiles[folder]
 	if !ok {
-		panic("bug: LocalVersion called for nonexistent folder " + folder)
+		// The folder might not exist, since this can be called with a user
+		// specified folder name from the REST interface.
+		return 0
 	}
 
 	return fs.LocalVersion(protocol.LocalDeviceID)