From 017c9f50b39c73653a4b5e6b7507f4159afaa1d5 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:43:40 +0200 Subject: [PATCH] Fix NPE --- stateresolutionv2.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stateresolutionv2.go b/stateresolutionv2.go index 814f6f33..9bda07c5 100644 --- a/stateresolutionv2.go +++ b/stateresolutionv2.go @@ -84,6 +84,17 @@ func ResolveStateConflictsV2( panic(err) } } + if len(authEvents) > 0 { + roomID, err = spec.NewRoomID(authEvents[0].RoomID()) + if err != nil { + panic(err) + } + } + // If we still don't have a roomID, we don't have conflicted, unconflicted + // or any authEvents, which in theory shouldn't happen. + if roomID == nil { + return r.result + } r.allower = newAllowerContext(&r.authProvider, userIDForSender, *roomID)