From cf75329067e0e578f94c32c0e4eb5d46a76e6ef4 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Wed, 20 May 2020 11:13:55 +0200 Subject: [PATCH] lib/model: Handle concurrently removed device in ClusterConfig (#6666) --- lib/model/model.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/model/model.go b/lib/model/model.go index 45c0dad3b..40b658a66 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -956,7 +956,11 @@ func (m *model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon } changed := false - deviceCfg := m.cfg.Devices()[deviceID] + deviceCfg, ok := m.cfg.Devices()[deviceID] + if !ok { + l.Debugln("Device disappeared from config while processing cluster-config") + return errDeviceUnknown + } // Needs to happen outside of the fmut, as can cause CommitConfiguration if deviceCfg.AutoAcceptFolders {