summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Bode <dan@puppetlabs.com>2013-03-11 17:31:00 -0700
committerDan Bode <dan@puppetlabs.com>2013-03-11 17:42:08 -0700
commit5f71d7f0bd78bbcc587210c9d251b92e1a1dea0f (patch)
treef0727439eb02070077c999d435ee765396a88802 /lib
parent2008179ebea70d296f65a1809c961951884a7b11 (diff)
downloadpuppet-inifile-5f71d7f0bd78bbcc587210c9d251b92e1a1dea0f.tar.gz
puppet-inifile-5f71d7f0bd78bbcc587210c9d251b92e1a1dea0f.tar.bz2
guard against nil indentation values
This commit is intended to resolves an issue where the indentation value can be nil (which leads to a run time exception) This occurrs in cases where a section is following by only one of more comments. The proposed fix is to guard against potential nil values where the error occurs. This fix is idential to code used at line 125 of the same file.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/util/ini_file.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/puppet/util/ini_file.rb b/lib/puppet/util/ini_file.rb
index 90b0c7b..9c78a01 100644
--- a/lib/puppet/util/ini_file.rb
+++ b/lib/puppet/util/ini_file.rb
@@ -256,7 +256,7 @@ module Util
def insert_inline_setting_line(result, section, setting, value)
line_num = result[:line_num]
match = result[:match]
- lines.insert(line_num + 1, "#{' ' * section.indentation}#{setting}#{match[4]}#{value}")
+ lines.insert(line_num + 1, "#{' ' * (section.indentation || 0 )}#{setting}#{match[4]}#{value}")
end
# Utility method; given a section index (index into the @section_names