lipkau / PsIni

Work with INI files in PowerShell using hashtables
http://lipkau.github.io/PsIni
MIT License
150 stars 50 forks source link

Writing a .ini file with an empty section #26

Closed popojargo closed 7 years ago

popojargo commented 7 years ago

The issue occurs when I try to write an empty section. Here's a file parsed that I try to write back :

[emptysection]

[anothersection]
value = 1

The error that I received :

Out-Keys : Cannot validate argument on parameter 'InputObject'. The argument is null, empty, or an 
element of the argument collection contains a null value. Supply a collection that does not contain any 
null values and then try the command again.
At D:\Scripts\PowerShell modules\PsIni-master\Functions\Out-IniFile.ps1:219 char:26
+                 Out-Keys $InputObject[$i] `
+                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Out-Keys], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Out-Keys

Any Idea what should be done here?

popojargo commented 7 years ago

27 Made a PR. Let me know what you think about it.

lipkau commented 7 years ago

worked fine. thanks