Skip to content

Commit 07fbef1

Browse files
committed
Merge pull request matplotlib#3592 from mdboom/picking-empty
Fix crash in picking for zero-length path collection
2 parents 7e6be9d + 5e2b03c commit 07fbef1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/_path.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,14 @@ _path_module::point_in_path_collection(const Py::Tuple& args)
770770
throw Py::ValueError("Offsets array must be Nx2");
771771
}
772772

773+
Py::List result;
774+
773775
size_t Npaths = paths.length();
776+
777+
if (Npaths == 0) {
778+
return result;
779+
}
780+
774781
size_t Noffsets = offsets->dimensions[0];
775782
size_t N = std::max(Npaths, Noffsets);
776783
size_t Ntransforms = std::min(transforms_obj.length(), N);
@@ -788,7 +795,6 @@ _path_module::point_in_path_collection(const Py::Tuple& args)
788795
transforms.push_back(trans);
789796
}
790797

791-
Py::List result;
792798
agg::trans_affine trans;
793799

794800
for (i = 0; i < N; ++i)

0 commit comments

Comments
 (0)