浏览代码

Fix crash

Maarten van den Berg 6 年之前
父节点
当前提交
990ddb5663
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/controllers/api/activities_controller.rb

+ 6 - 1
app/controllers/api/activities_controller.rb

@@ -93,7 +93,12 @@ class Api::ActivitiesController < ApiController
93 93
 
94 94
   # Set activity from the :id-parameter, and assert that it belongs to the set @group.
95 95
   def set_activity_from_group
96
-    @activity = Activity.find(params[:id])
96
+    @activity = Activity.find_by id: params[:id]
97
+    unless @activity
98
+      head :not_found
99
+      return
100
+    end
101
+
97 102
     head :unauthorized unless @activity.group == @group
98 103
   end
99 104
 end