From 2c06ca5615c1c16af579ad2229e3a48be6ace05e Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Tue, 7 Feb 2023 09:03:26 +0900 Subject: [PATCH] Fix account serializer crash if account doesn't have a user (#23428) --- app/serializers/rest/account_serializer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index 62eac1fbde..f6fad9fe14 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -125,10 +125,10 @@ class REST::AccountSerializer < ActiveModel::Serializer end def roles - if object.suspended? + if object.suspended? || object.user.nil? [] else - [object.user.role].compact.filter { |role| role.highlighted? } + [object.user.role].compact.filter(&:highlighted?) end end