handle case alias can be None in toggle_alias

This commit is contained in:
Son NK 2020-09-05 20:54:08 +02:00
parent e36768824f
commit 5cf0a4bcfe
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ def toggle_alias(alias_id):
user = g.user
alias: Alias = Alias.get(alias_id)
if alias.user_id != user.id:
if not alias or alias.user_id != user.id:
return jsonify(error="Forbidden"), 403
alias.enabled = not alias.enabled