Skip to content

Commit

Permalink
Merge pull request #45 from bkemper24/main
Browse files Browse the repository at this point in the history
check for empty list in setListValue
  • Loading branch information
bkemper24 authored Feb 2, 2023
2 parents 9a5ef8d + c63a41f commit d72b358
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions R/swat.R
Original file line number Diff line number Diff line change
Expand Up @@ -2205,16 +2205,19 @@ setListValue <- function(sw_values, i, key, value) {
{
sw_sublist <- sw_values$createListAt(i, key, length(value))
swat::errorcheck(sw_values)
for ( j in 1:length(value) )
if ( length(value) > 0 )
{
if ( is.null(names(value[j])) || nchar(names(value[j])) == 0 )
{
setListValue(sw_sublist, j-1, '', value[[j]])
}
else
{
setListValue(sw_sublist, j-1, names(value[j]), value[[j]])
}
for ( j in 1:length(value) )
{
if ( is.null(names(value[j])) || nchar(names(value[j])) == 0 )
{
setListValue(sw_sublist, j-1, '', value[[j]])
}
else
{
setListValue(sw_sublist, j-1, names(value[j]), value[[j]])
}
}
}
return (i + 1)
}
Expand Down

0 comments on commit d72b358

Please sign in to comment.