Fixed logged out character page

This commit is contained in:
Eduard Urbach 2018-04-19 17:50:20 +02:00
parent 290c18b8b9
commit 1dfd15f691

View File

@ -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))