From 89b66bc3750f88d9350acbe56b0981b6de631c39 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 19 Aug 2021 07:51:42 +0200 Subject: [PATCH] fdfd --- files/routes/votes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/votes.py b/files/routes/votes.py index c2fb49e1d..eeb4a625a 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -71,7 +71,7 @@ def api_vote_post(post_id, new, v): # check for existing vote existing = g.db.query(Vote).filter_by(user_id=v.id, submission_id=post.id).first() - if existing.vote_type == new: return "", 204 + if existing and existing.vote_type == new: return "", 204 if existing: if existing.vote_type == 0 and new != 0: @@ -121,7 +121,7 @@ def api_vote_comment(comment_id, new, v): # check for existing vote existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).first() - if existing.vote_type == new: return "", 204 + if existing and existing.vote_type == new: return "", 204 if existing: if existing.vote_type == 0 and new != 0: