From 5357df36c9adc6de24653f181a5d3a5070a23ce2 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 21 Jun 2021 09:41:12 +0100 Subject: [PATCH] Fix panic in roomserver --- roomserver/storage/shared/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index 096d5d7a8..e77d62e06 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -156,7 +156,7 @@ func (d *Database) AddState( stateBlockNIDs []types.StateBlockNID, state []types.StateEntry, ) (stateNID types.StateSnapshotNID, err error) { - if len(stateBlockNIDs) > 0 { + if len(stateBlockNIDs) > 0 && len(state) > 0 { // Check to see if the event already appears in any of the existing state // blocks. If it does then we should not add it again, as this will just // result in excess state blocks and snapshots.