From e314be1ed09f0d5215cd1225a51f911dbecbec09 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 24 Nov 2021 09:21:23 +0100 Subject: [PATCH] Fix access to first community solution --- app/controllers/community_solutions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/community_solutions_controller.rb b/app/controllers/community_solutions_controller.rb index ee432fd4..ee61adbf 100644 --- a/app/controllers/community_solutions_controller.rb +++ b/app/controllers/community_solutions_controller.rb @@ -34,7 +34,7 @@ class CommunitySolutionsController < ApplicationController end all_visible_files = last_contribution.files.select(&:visible) # Add the ReadMe file first - @files += all_visible_files.select {|f| CodeOcean::File.find_by(id: f.file_id).context_type == 'CommunitySolution' } + @files += all_visible_files.select {|f| CodeOcean::File.find_by(id: f.file_id)&.context_type == 'CommunitySolution' } # Then, add all remaining files and sort them by name with extension @files += (all_visible_files - @files).sort_by(&:name_with_extension)