Skip to content

Commit

Permalink
Update view to handle for logged-in user with null userprofile
Browse files Browse the repository at this point in the history
  • Loading branch information
c-e-p committed May 26, 2023
1 parent 83655f9 commit 7a178a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ourchive_app/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def index(request):
if request.user.is_authenticated:
request_url = f"api/users/{request.user.id}/"
response = do_get(request_url, request)[0]
if 'userprofile' in response and response['userprofile']['has_notifications']:
if 'userprofile' in response and response['userprofile'] is not None and 'has_notifications' in response['userprofile']:
has_notifications = response['userprofile']['has_notifications']
request.session['has_notifications'] = has_notifications
else:
Expand Down

0 comments on commit 7a178a7

Please sign in to comment.