Skip to content

Commit

Permalink
Merge pull request #16951 from d-m-u/bz_1540713
Browse files Browse the repository at this point in the history
Add nil check to serializer for invalid categories
(cherry picked from commit 0e35ec3)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1542606
  • Loading branch information
gmcculloug authored and simaishi committed Feb 6, 2018
1 parent 7f3a211 commit d8bd20b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/dialog_field_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def serialize(dialog_field, all_attributes = false)

if dialog_field.type == "DialogFieldTagControl"
category = Category.find_by(:id => dialog_field.category)
dialog_field.options.merge!(:category_name => category.name, :category_description => category.description)
dialog_field.options.merge!(:category_name => category.name, :category_description => category.description) if category
end
included_attributes(dialog_field.as_json(:methods => [:type, :values]), all_attributes).merge(extra_attributes)
end
Expand Down

0 comments on commit d8bd20b

Please sign in to comment.