From 05062bfd87419f1b9fd3056a5ebbacc5f91c4bc6 Mon Sep 17 00:00:00 2001 From: Bryce Boe Date: Fri, 6 Jan 2012 16:49:08 -0800 Subject: [PATCH] Fix 500 error when attempting to subscribe to a non-existent subreddit. --- r2/r2/controllers/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index ffd4c7928..6d56682f6 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1940,7 +1940,7 @@ class ApiController(RedditController): def POST_subscribe(self, action, sr): # only users who can make edits are allowed to subscribe. # Anyone can leave. - if action != 'sub' or sr.can_comment(c.user): + if sr and (action != 'sub' or sr.can_comment(c.user)): self._subscribe(sr, action == 'sub') @classmethod