Skip to content

Commit cebd1e4

Browse files
author
Justin Kufro
committed
bug fix for aws_config_mapper#check_text function if input_parameters are nil
1 parent dd4e448 commit cebd1e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/heimdall_tools/aws_config_mapper.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,10 @@ def hdf_tags(config_rule)
257257
end
258258

259259
def check_text(config_rule)
260-
params = (JSON.parse(config_rule[:input_parameters]).map { |key, value| "#{key}: #{value}" }).join('<br/>')
261-
check_text = config_rule[:config_rule_arn]
260+
# If no input parameters, then provide an empty JSON array to the JSON
261+
# parser because passing nil to JSON.parse throws an exception.
262+
params = (JSON.parse(config_rule[:input_parameters] || '[]').map { |key, value| "#{key}: #{value}" }).join('<br/>')
263+
check_text = config_rule[:config_rule_arn] || ''
262264
check_text += "<br/>#{params}" unless params.empty?
263265
check_text
264266
end

0 commit comments

Comments
 (0)