Browse Source

Fix crash

Maarten van den Berg 6 years ago
parent
commit
990ddb5663
1 changed files with 6 additions and 1 deletions
  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