Check for missing state keys to avoid panicking

This commit is contained in:
Kegan Dougal 2021-07-19 10:21:25 +01:00
parent b954343d73
commit 77d439dddf

View file

@ -174,6 +174,13 @@ func SendLeave(
} }
} }
if event.StateKey() == nil {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.InvalidArgumentValue("missing state_key"),
}
}
// Check if the user has already left. If so, no-op! // Check if the user has already left. If so, no-op!
queryReq := &api.QueryLatestEventsAndStateRequest{ queryReq := &api.QueryLatestEventsAndStateRequest{
RoomID: roomID, RoomID: roomID,