From a40ef76116102daf68b4c0b466d77f7f09b5de68 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Fri, 12 Jun 2020 16:46:04 +0200 Subject: [PATCH] prevent nil errors --- lib/bootstrap_form/components/labels.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootstrap_form/components/labels.rb b/lib/bootstrap_form/components/labels.rb index 240558e2f..64caa7d5a 100644 --- a/lib/bootstrap_form/components/labels.rb +++ b/lib/bootstrap_form/components/labels.rb @@ -48,7 +48,7 @@ def label_text(name, options) if label_errors && error?(name) (options[:text] || object.class.human_attribute_name(name)).to_s.concat(" #{get_error_messages(name)}") else - options[:text] || object.class.human_attribute_name(name) + options[:text] || object&.class&.human_attribute_name(name) end end end