Skip to content

Commit 43333cc

Browse files
committed
update: 세션의 user가 None인 경우 예외처리
1 parent d3e4a0e commit 43333cc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

session/serializers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@ def get_category_name(obj: Session):
6565

6666
def to_representation(self, instance: Session):
6767
response = super().to_representation(instance)
68-
response["user"] = UserExtSerializer(instance.user.userext).data
68+
69+
if instance.user is not None:
70+
response["user"] = UserExtSerializer(instance.user.userext).data
71+
else:
72+
response["user"] = {
73+
"nickname": "",
74+
"bio": "",
75+
"profile_img": ""
76+
}
77+
6978
return response
7079

7180

0 commit comments

Comments
 (0)