Skip to content

Commit 226d208

Browse files
authored
Fix NPE when resolving state (#401)
1 parent 35f734f commit 226d208

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

stateresolutionv2.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ func ResolveStateConflictsV2(
8484
panic(err)
8585
}
8686
}
87+
if len(authEvents) > 0 {
88+
roomID, err = spec.NewRoomID(authEvents[0].RoomID())
89+
if err != nil {
90+
panic(err)
91+
}
92+
}
93+
// If we still don't have a roomID, we don't have conflicted, unconflicted
94+
// or any authEvents, which in theory shouldn't happen.
95+
if roomID == nil {
96+
return r.result
97+
}
8798

8899
r.allower = newAllowerContext(&r.authProvider, userIDForSender, *roomID)
89100

0 commit comments

Comments
 (0)