Skip to content

Commit 5337c64

Browse files
committed
check time_type validity to determine min/max handling
1 parent cf614e7 commit 5337c64

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

R/archive.R

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -188,28 +188,16 @@ epi_archive =
188188
})
189189
}
190190
cat("----------\n")
191+
if (length(self$DT$time_value) == 0 || all(is.na(self$DT$time_value)) || all(is.nan(self$DT$time_value))) {
192+
min_time = max_time = NA
193+
} else {
194+
min_time = Min(self$DT$time_value)
195+
max_time = Max(self$DT$time_value)
196+
}
191197
cat(sprintf("* %-14s = %s\n", "min time value",
192-
tryCatch({
193-
Min(self$DT$time_value)
194-
},
195-
warning = function(w) {
196-
if (w$message != "no non-missing arguments to min; returning Inf") {
197-
warning(w)
198-
}
199-
NA
200-
}
201-
)))
198+
min_time))
202199
cat(sprintf("* %-14s = %s\n", "max time value",
203-
tryCatch({
204-
Max(self$DT$time_value)
205-
},
206-
warning = function(w) {
207-
if (w$message != "no non-missing arguments to max; returning -Inf") {
208-
warning(w)
209-
}
210-
NA
211-
}
212-
)))
200+
max_time))
213201
cat(sprintf("* %-14s = %s\n", "min version",
214202
min(self$DT$version)))
215203
cat(sprintf("* %-14s = %s\n", "max version",

0 commit comments

Comments
 (0)