Repository: syncthing/syncthing (language: go)

Issue:
Panic in failure reporting
```
[start] 2022/07/31 08:25:34 INFO: syncthing v1.20.3-dev.8.gec069743-tomasz86-v1.20.2 "Fermium Flea" (go1.18.3 windows-amd64) tomasz86@tomasz86 2022-06-07 07:12:59 UTC [noupgrade, stnoupgrade]
Panic at 2022-07-31T10:24:39+09:00
panic: assignment to entry in nil map

goroutine 30 [running]:
github.com/syncthing/syncthing/lib/model.(*deadlockDetector).watchInner(0xc00019cc00, {0x1a63b64, 0x4}, 0xc000fe3440)
	github.com/syncthing/syncthing/lib/model/util.go:73 +0x22c
github.com/syncthing/syncthing/lib/model.(*deadlockDetector).Watch.func1()
	github.com/syncthing/syncthing/lib/model/util.go:57 +0x65
created by github.com/syncthing/syncthing/lib/model.(*deadlockDetector).Watch
	github.com/syncthing/syncthing/lib/model/util.go:45 +0x115
goroutine 1 [chan receive, 118 minutes]:
```

https://forum.syncthing.net/t/panic-assignment-to-entry-in-nil-map/18791


Discussion / hints:

Fix patch:
diff --git a/lib/model/model.go b/lib/model/model.go
index 9fdc39d3861..0f66cbedd7f 100644
--- a/lib/model/model.go
+++ b/lib/model/model.go
@@ -877,9 +877,14 @@ func (m *model) Completion(device protocol.DeviceID, folder string) (FolderCompl
 	// We want completion for all (shared) folders as an aggregate.
 	var comp FolderCompletion
 	for _, fcfg := range m.cfg.FolderList() {
+		if fcfg.Paused {
+			continue
+		}
 		if device == protocol.LocalDeviceID || fcfg.SharedWith(device) {
 			folderComp, err := m.folderCompletion(device, fcfg.ID)
-			if err != nil {
+			if errors.Is(err, ErrFolderPaused) {
+				continue
+			} else if err != nil {
 				return FolderCompletion{}, err
 			}
 			comp.add(folderComp)


Test patch: