mirror of
https://github.com/fiatjaf/khatru.git
synced 2026-06-06 10:41:12 +02:00
fix writeErr nil pointer.
This commit is contained in:
@@ -144,10 +144,11 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
|
|||||||
writeErr = rl.AddEvent(ctx, &env.Event)
|
writeErr = rl.AddEvent(ctx, &env.Event)
|
||||||
}
|
}
|
||||||
|
|
||||||
reason := writeErr.Error()
|
var reason string
|
||||||
if writeErr == nil {
|
if writeErr == nil {
|
||||||
ok = true
|
ok = true
|
||||||
} else {
|
} else {
|
||||||
|
reason = writeErr.Error()
|
||||||
if strings.HasPrefix(reason, "auth-required:") {
|
if strings.HasPrefix(reason, "auth-required:") {
|
||||||
ws.WriteJSON(nostr.AuthEnvelope{Challenge: &ws.Challenge})
|
ws.WriteJSON(nostr.AuthEnvelope{Challenge: &ws.Challenge})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user