Handle case where activity cannot be found.

This commit is contained in:
Sybren A. Stüvel 2016-07-21 17:00:06 +02:00
parent 03a041b96e
commit 684c24cbaf

View File

@ -12,7 +12,7 @@ def notification_parse(notification):
nodes_collection = current_app.data.driver.db['nodes']
activity = activities_collection.find_one({'_id': notification['activity']})
if activity['object_type'] != 'node':
if activity is None or activity['object_type'] != 'node':
return
node = nodes_collection.find_one({'_id': activity['object']})
# Initial support only for node_type comments