aboutsummaryrefslogtreecommitdiff
path: root/roomserver/storage/sqlite3/events_table.go
diff options
context:
space:
mode:
Diffstat (limited to 'roomserver/storage/sqlite3/events_table.go')
-rw-r--r--roomserver/storage/sqlite3/events_table.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/roomserver/storage/sqlite3/events_table.go b/roomserver/storage/sqlite3/events_table.go
index 3127eb17..7483e281 100644
--- a/roomserver/storage/sqlite3/events_table.go
+++ b/roomserver/storage/sqlite3/events_table.go
@@ -322,7 +322,9 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
); err != nil {
return nil, err
}
- if result.BeforeStateSnapshotNID == 0 {
+ // Genuine create events are the only case where it's OK to have no previous state.
+ isCreate := result.EventTypeNID == types.MRoomCreateNID && result.EventStateKeyNID == 1
+ if result.BeforeStateSnapshotNID == 0 && !isCreate {
return nil, types.MissingEventError(
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
)