mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
Check if PrevContent is nil before using. Fixes #181
This commit is contained in:
parent
48537f98ce
commit
68956c4c63
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue