Fix panic in redaction handling

This commit is contained in:
Tulir Asokan 2019-06-16 21:24:51 +03:00
parent d1d129f6cf
commit c6ca343cd1
2 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ func (hm *HistoryManager) Update(room *rooms.Room, eventID string, update func(e
} }
stream := tx.Bucket(bucketRoomStreams).Bucket(rid) stream := tx.Bucket(bucketRoomStreams).Bucket(rid)
eventData := stream.Get(streamIndex) eventData := stream.Get(streamIndex)
if eventData == nil { if eventData == nil || len(eventData) == 0 {
return EventNotFoundError return EventNotFoundError
} }

View File

@ -321,7 +321,7 @@ func (c *Container) HandleRedaction(source EventSource, evt *mautrix.Event) {
debug.Print("Failed to mark", evt.Redacts, "as redacted:", err) debug.Print("Failed to mark", evt.Redacts, "as redacted:", err)
} }
if !room.Loaded() { if !room.Loaded() || redactedEvt == nil {
return return
} }