fix event extra: create a map when it doesn't exist.

This commit is contained in:
fiatjaf 2022-11-18 14:16:17 -03:00
parent 0d7a4b258a
commit e09f6b4bff
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -2,6 +2,9 @@ package nostr
// SetExtra sets an out-of-the-spec value under the given key into the event object.
func (evt *Event) SetExtra(key string, value any) {
if evt.extra == nil {
evt.extra = make(map[string]any)
}
evt.extra[key] = value
}