From 110e1ae6f9e773ba58e02c3de2e0b59ce81e6ae3 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 14 Nov 2024 20:59:34 +0100 Subject: [PATCH] fix(model): don't panic in index consistency print (fixes #9821) (#9823) We try to compare to the last fileinfo, but apparently we can end up here with an empty file list and crash on out of index. --- lib/model/indexhandler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/model/indexhandler.go b/lib/model/indexhandler.go index 407821bb5..f72315310 100644 --- a/lib/model/indexhandler.go +++ b/lib/model/indexhandler.go @@ -448,7 +448,7 @@ func (s *indexHandler) receive(fs []protocol.FileInfo, update bool, op string, p seq := fset.Sequence(deviceID) // Check that the sequence we get back is what we put in... - if lastSequence > 0 && seq != lastSequence { + if lastSequence > 0 && len(fs) > 0 && seq != lastSequence { s.logSequenceAnomaly("unexpected sequence after update", map[string]any{ "prevSeq": prevSequence, "lastSeq": lastSequence,