try to prevent pointer to pointer bug.

This commit is contained in:
fiatjaf
2025-03-10 16:16:44 -03:00
parent 769887fac1
commit 74e121075e
2 changed files with 16 additions and 2 deletions

View File

@@ -16,12 +16,26 @@ func EncodePointer(pointer nostr.Pointer) string {
res, _ := EncodeProfile(v.PublicKey, v.Relays)
return res
}
case *nostr.ProfilePointer:
if v.Relays == nil {
res, _ := EncodePublicKey(v.PublicKey)
return res
} else {
res, _ := EncodeProfile(v.PublicKey, v.Relays)
return res
}
case nostr.EventPointer:
res, _ := EncodeEvent(v.ID, v.Relays, v.Author)
return res
case *nostr.EventPointer:
res, _ := EncodeEvent(v.ID, v.Relays, v.Author)
return res
case nostr.EntityPointer:
res, _ := EncodeEntity(v.PublicKey, v.Kind, v.Identifier, v.Relays)
return res
case *nostr.EntityPointer:
res, _ := EncodeEntity(v.PublicKey, v.Kind, v.Identifier, v.Relays)
return res
}
return ""
}