diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-06-24 22:54:41 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-06-24 22:54:41 +0300 |
commit | 68956c4c63702b50157872bfca057f839a1a51aa (patch) | |
tree | ff7916cb2d63c2bfcc0c2eb68d03da99ed6e0270 | |
parent | 48537f98ce54e63d8df3d67f73372edf735b217f (diff) |
Check if PrevContent is nil before using. Fixes #181
-rw-r--r-- | ui/messages/parser.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ui/messages/parser.go b/ui/messages/parser.go index 94c657b..90530c3 100644 --- a/ui/messages/parser.go +++ b/ui/messages/parser.go @@ -156,8 +156,11 @@ func ParseStateEvent(evt *muksevt.Event, displayname string) *UIMessage { AppendColor(".", tcell.ColorGreen) } case *event.CanonicalAliasEventContent: - _ = evt.Unsigned.PrevContent.ParseRaw(evt.Type) - prevContent := evt.Unsigned.PrevContent.AsCanonicalAlias() + prevContent := &event.CanonicalAliasEventContent{} + if evt.Unsigned.PrevContent != nil { + _ = evt.Unsigned.PrevContent.ParseRaw(evt.Type) + prevContent = evt.Unsigned.PrevContent.AsCanonicalAlias() + } debug.Printf("%+v -> %+v", prevContent, content) if len(content.Alias) == 0 && len(prevContent.Alias) != 0 { text = text.AppendColor("removed the main address of the room", tcell.ColorGreen) |