khatru: fix for panics when expiration manager is nil.

This commit is contained in:
fiatjaf
2025-10-14 01:52:10 +00:00
parent 9e41bc69c4
commit d85bb8aa1b
2 changed files with 6 additions and 2 deletions

View File

@@ -61,7 +61,9 @@ func (rl *Relay) handleNormal(ctx context.Context, evt nostr.Event) (skipBroadca
}
// track event expiration if applicable
rl.expirationManager.trackEvent(evt)
if rl.expirationManager != nil {
rl.expirationManager.trackEvent(evt)
}
return false, nil
}

View File

@@ -67,7 +67,9 @@ func (rl *Relay) handleDeleteRequest(ctx context.Context, evt nostr.Event) error
}
// if it was tracked to be expired that is not needed anymore
rl.expirationManager.removeEvent(target.ID)
if rl.expirationManager != nil {
rl.expirationManager.removeEvent(target.ID)
}
} else {
// fail and stop here
return fmt.Errorf("blocked: %s", msg)