Skip to content

Commit

Permalink
isTruthy() should check for NULL before is.atomic()
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Oct 2, 2023
1 parent 314f7ad commit 8fefdd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1243,11 +1243,12 @@ isTruthy <- function(x) {
if (inherits(x, 'try-error'))
return(FALSE)

if (is.null(x))
return(FALSE)

if (!is.atomic(x))
return(TRUE)

if (is.null(x))
return(FALSE)
if (length(x) == 0)
return(FALSE)
if (all(is.na(x)))
Expand Down

0 comments on commit 8fefdd0

Please sign in to comment.