khatru: fix for panics when expiration manager is nil.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user