about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-08-11 16:40:55 +0200
committerGitHub <noreply@github.com>2021-08-11 16:40:55 +0200
commit13b08610a08faf2909f7c871be62da955d9293d3 (patch)
treeff6b7804a9972bc7da5d08b8624c5052ff9c1593 /app/models/account.rb
parent229f5d1681577c60e2aa0ab7240c5115acd9434a (diff)
Fix crash when encountering invalid account fields (#16598)
* Add test

* Fix crash when encountering invalid account fields
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index a6d8d1537..f7a7f4a7b 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -295,7 +295,11 @@ class Account < ApplicationRecord
   end
 
   def fields
-    (self[:fields] || []).map { |f| Field.new(self, f) }
+    (self[:fields] || []).map do |f|
+      Field.new(self, f)
+    rescue
+      nil
+    end.compact
   end
 
   def fields_attributes=(attributes)