lib/model: Remove incorrect/useless panics (#5881)

This commit is contained in:
Simon Frei 2019-07-23 10:51:16 +02:00 committed by GitHub
parent 7b3d9a8dca
commit 6f08162376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -68,7 +68,7 @@ func (f *sendOnlyFolder) pull() bool {
curFile, ok := f.fset.Get(protocol.LocalDeviceID, intf.FileName()) curFile, ok := f.fset.Get(protocol.LocalDeviceID, intf.FileName())
if !ok { if !ok {
if intf.IsDeleted() { if intf.IsDeleted() {
panic("Should never get a deleted file as needed when we don't have it") l.Debugln("Should never get a deleted file as needed when we don't have it")
} }
return true return true
} }

View File

@ -248,10 +248,8 @@ func (m *model) StartFolder(folder string) {
// Need to hold lock on m.fmut when calling this. // Need to hold lock on m.fmut when calling this.
func (m *model) startFolderLocked(cfg config.FolderConfiguration) { func (m *model) startFolderLocked(cfg config.FolderConfiguration) {
if err := m.checkFolderRunningLocked(cfg.ID); err == errFolderMissing { _, ok := m.folderRunners[cfg.ID]
l.Warnln("Cannot start nonexistent folder", cfg.Description()) if ok {
panic("cannot start nonexistent folder")
} else if err == nil {
l.Warnln("Cannot start already running folder", cfg.Description()) l.Warnln("Cannot start already running folder", cfg.Description())
panic("cannot start already running folder") panic("cannot start already running folder")
} }