# Description
Summary of changes:
- Exit the function if the arrayList is empty.

# Change type
- [x] Bug fix (non-breaking change)
- [ ] Code style update (formatting, local variables)
- [ ] New Feature (non-breaking change that adds new functionality
without impacting existing)
- [ ] Breaking change (fix or feature that may cause functionality
impact)
- [ ] Other

# Checklist:
- [x] My code follows the style and contribution guidelines of this
project.
- [x] I have tested and validated my code changes.
This commit is contained in:
Adam Rudell 2024-10-28 02:21:55 -05:00 коммит произвёл GitHub
Родитель 86fe93bba0
Коммит 07b9dd929e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -43,9 +43,7 @@ function Export-ObjectToFile {
# create the parent directory structure if does not already exist
if(!(Test-Path -Path $fileName.Directory -PathType Container)){
try {
"Creating directory {0}" -f $fileName.Directory | Trace-Output -Level:Verbose
$null = New-Item -Path $fileName.Directory -ItemType Directory -ErrorAction Stop
}
catch {
@ -55,14 +53,13 @@ function Export-ObjectToFile {
}
}
process {
# if object is null, then exit
if ($null -eq $Object) {
return
}
$arrayList.AddRange($Object)
}
end {
if ($arrayList.Count -eq 0) {
return
}
try {
"Creating file {0}" -f $fileName | Trace-Output -Level:Verbose
switch($FileType){