From 487a336d1a0334b064bfb3e0bbcc7ff7f000219b Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Tue, 1 Nov 2022 14:28:42 +0100 Subject: [PATCH] Don't panic! --- roomserver/state/state.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roomserver/state/state.go b/roomserver/state/state.go index 83e048325..2165903ec 100644 --- a/roomserver/state/state.go +++ b/roomserver/state/state.go @@ -171,7 +171,7 @@ func (v *StateResolution) LoadMembershipAtEvent( if !ok { // This should only get hit if the database is corrupt. // It should be impossible for an event to reference a NID that doesn't exist - panic(fmt.Errorf("corrupt DB: Missing state snapshot numeric ID %d", stateBlockNIDList.StateSnapshotNID)) + return nil, fmt.Errorf("corrupt DB: Missing state snapshot numeric ID %d", stateBlockNIDList.StateSnapshotNID) } for _, stateBlockNID := range stateBlockNIDs { @@ -179,7 +179,7 @@ func (v *StateResolution) LoadMembershipAtEvent( if !ok { // This should only get hit if the database is corrupt. // It should be impossible for an event to reference a NID that doesn't exist - panic(fmt.Errorf("corrupt DB: Missing state block numeric ID %d", stateBlockNID)) + return nil, fmt.Errorf("corrupt DB: Missing state block numeric ID %d", stateBlockNID) } evIDs := snapshotNIDMap[stateBlockNIDList.StateSnapshotNID]