From f3e8a9a4cbd63e0bd724bbef4172b810c8040fa6 Mon Sep 17 00:00:00 2001 From: Till <2353100+S7evinK@users.noreply.github.com> Date: Thu, 7 Jul 2022 11:40:53 +0200 Subject: [PATCH] Fix nil pointer access when redacting events (#2560) --- roomserver/storage/shared/storage.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index 3191280c..ba937ba3 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -834,6 +834,9 @@ func (d *Database) handleRedactions( if err != nil { return nil, "", fmt.Errorf("d.GetStateEvent: %w", err) } + if powerLevels == nil { + return nil, "", fmt.Errorf("unable to fetch m.room.power_levels event from database for room %s", event.RoomID()) + } pl, err := powerLevels.PowerLevels() if err != nil { return nil, "", fmt.Errorf("unable to get powerlevels for room: %w", err)