Skip to content

Commit 1f3ac2a

Browse files
authored
Avoid calling extrema(...; dims) with empty arrays (#1711)
There's a proposed "minor change" to Julia v1.13 that would make `extrema([], dims=2)` (and other such reductions) an error, akin to how `extrema([])` is an error when `init` is not specified. This package was flagged as having (at least) one such usage here; it errored in [PkgEval](https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/813bcf3_vs_c3e7b1b/report.html). See JuliaLang/julia#55628 for more details. This addresses that first such usage; there may be [other places](https://github.com/search?q=repo%3AGenericMappingTools%2FGMT.jl+%2F%28%3F%3Aextrema%7Cminimum%7Cmaximum%29.*dims%2F&type=code) that similarly need to change by either supplying `init` or skipping the empty case entirely.
1 parent 705dc58 commit 1f3ac2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gmt_main.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ function get_dataset(API::Ptr{Nothing}, object::Ptr{Nothing})::GDtype
660660
unsafe_copyto!(pointer(dest, DS.n_rows * (col - 1) + 1), unsafe_load(DS.data, col), DS.n_rows)
661661
end
662662
Darr[seg_out].data = dest
663-
if (!isvector(dest)) # One-rowers do not have BBs
663+
if (!isvector(dest) && !isempty(dest)) # One-rowers do not have BBs
664664
bb = extrema(dest, dims=1) # A N Tuple.
665665
Darr[seg_out].bbox = collect(Float64, Iterators.flatten(bb))
666666
end

0 commit comments

Comments
 (0)