Skip to content

Commit 006610d

Browse files
committed
fix(get_hydrometrie_observations_tr): crashes when returns empty result
Closes #47
1 parent b91a7ed commit 006610d

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ Encoding: UTF-8
4848
Language: en-US
4949
LazyData: true
5050
Roxygen: list(markdown = TRUE)
51-
RoxygenNote: 7.3.1
51+
RoxygenNote: 7.3.2

R/get_hydrometrie.R

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ get_hydrometrie_observations_tr <- function(...,
6464
endpoint = "observations_tr",
6565
...
6666
)
67-
if(!is.null(l)) {
67+
if (length(l) > 0) {
6868
l <- lapply(l, function(x) {
6969
if (entities == "station") {
7070
if (is.null(x$code_station)) {
@@ -78,9 +78,8 @@ get_hydrometrie_observations_tr <- function(...,
7878
return(x)
7979
})
8080
l[sapply(l, is.null)] <- NULL
81-
l <- convert_list_to_tibble(l)
8281
}
83-
return(l)
82+
return(convert_list_to_tibble(l))
8483
}
8584

8685

tests/testthat/test-run_all_examples.R

-2
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,3 @@ lapply(db, function(Rd_fun) {
2525
})
2626
}
2727
})
28-
29-

0 commit comments

Comments
 (0)