khatru: fix for panics when expiration manager is nil.
This commit is contained in:
+3
-1
@@ -61,7 +61,9 @@ func (rl *Relay) handleNormal(ctx context.Context, evt nostr.Event) (skipBroadca
|
|||||||
}
|
}
|
||||||
|
|
||||||
// track event expiration if applicable
|
// track event expiration if applicable
|
||||||
rl.expirationManager.trackEvent(evt)
|
if rl.expirationManager != nil {
|
||||||
|
rl.expirationManager.trackEvent(evt)
|
||||||
|
}
|
||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -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
|
// 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 {
|
} else {
|
||||||
// fail and stop here
|
// fail and stop here
|
||||||
return fmt.Errorf("blocked: %s", msg)
|
return fmt.Errorf("blocked: %s", msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user