From bd99044e9c92b40ff7f816c667c1adeb72911ff9 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Tue, 12 Nov 2019 20:01:14 +0900 Subject: [PATCH] Fix 500 on tags page This fixes a panic from a nil user when calling u.IsSuspended(). Instead, this checks and calls IsSuspended() on `owner`. --- collections.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/collections.go b/collections.go index 54ddc8a..b85f0a4 100644 --- a/collections.go +++ b/collections.go @@ -905,11 +905,11 @@ func handleViewCollectionTag(app *App, w http.ResponseWriter, r *http.Request) e // Log the error and just continue log.Error("Error getting user for collection: %v", err) } + if owner.IsSilenced() { + return ErrCollectionNotFound + } } - if !isOwner && u.IsSilenced() { - return ErrCollectionNotFound - } - displayPage.Suspended = u.IsSilenced() + displayPage.Suspended = owner != nil && owner.IsSilenced() displayPage.Owner = owner coll.Owner = displayPage.Owner // Add more data