Skip to content

Commit bd417ca

Browse files
committed
Check geocoder_options nil case
Signed-off-by: Ko Nagase <[email protected]>
1 parent 847fd10 commit bd417ca

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/redmine_gtt/hooks/view_layouts_base_html_head_hook.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ def view_layouts_base_html_head(context={})
1414
def view_layouts_base_body_bottom(context={})
1515
tags = [];
1616
geocoder = {}
17-
begin
18-
geocoder = JSON.parse(Setting.plugin_redmine_gtt['default_geocoder_options'])
19-
rescue JSON::ParserError => exception
20-
Rails.logger.warn "Failed to parse setting's 'geocoder_options' as JSON: #{exception}\nUse default '{}' instead."
17+
geocoder_options = Setting.plugin_redmine_gtt['default_geocoder_options']
18+
if geocoder_options.present?
19+
begin
20+
geocoder = JSON.parse()
21+
rescue JSON::ParserError => exception
22+
Rails.logger.warn "Failed to parse setting's 'geocoder_options' as JSON: #{exception}\nUse default '{}' instead."
23+
end
2124
end
2225
tags.push(tag.div :data => {
2326
:lon => Setting.plugin_redmine_gtt['default_map_center_longitude'],

0 commit comments

Comments
 (0)