mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-22 23:00:50 +02:00
fix event extra: create a map when it doesn't exist.
This commit is contained in:
parent
0d7a4b258a
commit
e09f6b4bff
@ -2,6 +2,9 @@ package nostr
|
|||||||
|
|
||||||
// SetExtra sets an out-of-the-spec value under the given key into the event object.
|
// SetExtra sets an out-of-the-spec value under the given key into the event object.
|
||||||
func (evt *Event) SetExtra(key string, value any) {
|
func (evt *Event) SetExtra(key string, value any) {
|
||||||
|
if evt.extra == nil {
|
||||||
|
evt.extra = make(map[string]any)
|
||||||
|
}
|
||||||
evt.extra[key] = value
|
evt.extra[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user