Skip to content

Commit

Permalink
Add explicit checks for nil objects
Browse files Browse the repository at this point in the history
  • Loading branch information
jvendetti committed Dec 3, 2024
1 parent 0353288 commit b6f443b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit b6f443b

Please sign in to comment.