Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

fix: prevent nil pointer crash in BounceWebhook when bounce processing disabled (#2993)

Koushik Reddy Yeruva0db024ab64e7
diff --git a/cmd/bounce.go b/cmd/bounce.go
index 965d0a88..5235fa55 100644
--- a/cmd/bounce.go
+++ b/cmd/bounce.go
@@ -113,8 +113,15 @@ func (a *App) BlocklistBouncedSubscribers(c echo.Context) error {
return c.JSON(http.StatusOK, okResp{true})
}
-// BounceWebhook renders the HTML preview of a template.
+// BounceWebhook handles incoming bounce webhook notifications from various providers.
func (a *App) BounceWebhook(c echo.Context) error {
+ // If bounce processing is disabled, a.bounce will be nil.
+ // Return early to prevent nil pointer dereference.
+ if a.bounce == nil {
+ return echo.NewHTTPError(http.StatusServiceUnavailable,
+ a.i18n.Ts("globals.messages.internalError"))
+ }
+
// Read the request body instead of using c.Bind() to read to save the entire raw request as meta.
rawReq, err := io.ReadAll(c.Request().Body)
if err != nil {