Fix 500 error when attempting to subscribe to a non-existent subreddit.

This commit is contained in:
Bryce Boe
2012-01-06 16:49:08 -08:00
committed by Neil Williams
parent 4740772d23
commit 05062bfd87

View File

@@ -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