Skip to content

Commit 9956bf3

Browse files
committed
nrows(nothing) = 0
1 parent 09d8a61 commit 9956bf3

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/data_utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Return the number of rows for a table, abstract vector or matrix `X` $REQUIRE.
191191
nrows(X) = nrows(get_interface_mode(), vtrait(X), X)
192192

193193
nrows(::Mode, ::Val{:other}, X::AbstractVecOrMat) = size(X, 1)
194+
nrows(::Mode, ::Val{:other}, X::Nothing) = 0
194195

195196
nrows(::Mode, ::Val{:other}, X) =
196197
throw(ArgumentError("Function `nrows` only supports AbstractVector or " *

test/data_utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ end
9797
@test_throws ArgumentError nrows(X)
9898
X = (a=[4,2,1],b=[3,2,1])
9999
@test_throws M.InterfaceError nrows(X)
100+
@test nrows(nothing) == 0
100101
end
101102
@testset "nrows-full" begin
102103
setfull()

0 commit comments

Comments
 (0)