From 1dfd15f6912e884168f6fc42f481a156ae238687 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 19 Apr 2018 17:50:20 +0200 Subject: [PATCH] Fixed logged out character page --- pages/character/character.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pages/character/character.go b/pages/character/character.go index 36b4f171..d4b77fad 100644 --- a/pages/character/character.go +++ b/pages/character/character.go @@ -68,16 +68,19 @@ func Get(ctx *aero.Context) string { } // Friends - friendIDs := utils.Intersection(character.Likes, user.Follows().Items) - friendObjects := arn.DB.GetMany("User", friendIDs) - friends := []*arn.User{} + var friends []*arn.User - for _, obj := range friendObjects { - if obj == nil { - continue + if user != nil { + friendIDs := utils.Intersection(character.Likes, user.Follows().Items) + friendObjects := arn.DB.GetMany("User", friendIDs) + + for _, obj := range friendObjects { + if obj == nil { + continue + } + + friends = append(friends, obj.(*arn.User)) } - - friends = append(friends, obj.(*arn.User)) } return ctx.HTML(components.CharacterDetails(character, characterAnime, quotes, friends, mainQuote, user))