Skip to content

Commit 67666bf

Browse files
bjarthurCopilot
andauthored
handle d<1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b8c8183 commit 67666bf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/TensorStoreWrapper.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ end
233233

234234
# IndexDomainWrapper methods
235235
Base.size(w::IndexDomainWrapper) = pyconvert(Tuple, parent(w).shape)
236-
Base.size(w::IndexDomainWrapper, d::Integer) = d <= ndims(w) ? size(w)[d] : 1
236+
function Base.size(w::IndexDomainWrapper, d::Integer)
237+
d < 1 && throw(ArgumentError("dimension must be ≥ 1"))
238+
sz = size(w)
239+
return d <= length(sz) ? sz[d] : 1
240+
end
237241
Base.ndims(w::IndexDomainWrapper) = pyconvert(Int, parent(w).rank)
238242
function Base.axes(w::IndexDomainWrapper)
239243
rank = ndims(w)

0 commit comments

Comments
 (0)