Skip to content

Commit

Permalink
Fix crash in picking for zero-length path collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Sep 29, 2014
1 parent 7e6be9d commit 5e2b03c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/_path.cpp
Expand Up @@ -770,7 +770,14 @@ _path_module::point_in_path_collection(const Py::Tuple& args)
throw Py::ValueError("Offsets array must be Nx2");
}

Py::List result;

size_t Npaths = paths.length();

if (Npaths == 0) {
return result;
}

size_t Noffsets = offsets->dimensions[0];
size_t N = std::max(Npaths, Noffsets);
size_t Ntransforms = std::min(transforms_obj.length(), N);
Expand All @@ -788,7 +795,6 @@ _path_module::point_in_path_collection(const Py::Tuple& args)
transforms.push_back(trans);
}

Py::List result;
agg::trans_affine trans;

for (i = 0; i < N; ++i)
Expand Down

0 comments on commit 5e2b03c

Please sign in to comment.