diff --git a/app/controllers/ontologies_controller.rb b/app/controllers/ontologies_controller.rb index bdc90db40..7d4781618 100644 --- a/app/controllers/ontologies_controller.rb +++ b/app/controllers/ontologies_controller.rb @@ -255,7 +255,7 @@ def show # Note: find_by_acronym includes ontology views @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology], include: 'all').first - not_found if @ontology&.errors && [401, 403, 404].include?(@ontology&.status) + not_found if @ontology.nil? || (@ontology.errors && [401, 403, 404].include?(@ontology.status)) # Handle the case where an ontology is converted to summary only. # See: https://github.com/ncbo/bioportal_web_ui/issues/133. diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3a024bc1f..6916f22aa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -18,7 +18,7 @@ def index def show @project = LinkedData::Client::Models::Project.get(params[:id]) - not_found if @project&.errors && @project.status == 404 + not_found if @project.nil? || (@project.errors && @project.status == 404) @ontologies_used = [] onts_used = @project.ontologyUsed onts_used.each do |ont_used|