fix(r): fixing serializatin bug in empty json array (#4667)

* fix(r): fixing serializatin bug in empty json array

* fix(r): fixing serializatin bug in empty json array
This commit is contained in:
Ramanth Addala 2019-12-04 07:23:55 +05:30 committed by William Cheng
parent 01e84d79a0
commit e0d6f7df1f
2 changed files with 12 additions and 8 deletions

View File

@ -151,10 +151,12 @@ ApiClient <- R6::R6Class(
} }
} }
} else { } else {
returnObj <- vector("list", length = nrow(obj)) if(!is.null(nrow(obj))){
if (nrow(obj) > 0) { returnObj <- vector("list", length = nrow(obj))
for (row in 1:nrow(obj)) { if (nrow(obj) > 0) {
returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv) for (row in 1:nrow(obj)) {
returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv)
}
} }
} }
} }

View File

@ -149,10 +149,12 @@ ApiClient <- R6::R6Class(
} }
} }
} else { } else {
returnObj <- vector("list", length = nrow(obj)) if(!is.null(nrow(obj))){
if (nrow(obj) > 0) { returnObj <- vector("list", length = nrow(obj))
for (row in 1:nrow(obj)) { if (nrow(obj) > 0) {
returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv) for (row in 1:nrow(obj)) {
returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv)
}
} }
} }
} }