diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index b6438a90242c..a62893077c86 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -355,7 +355,9 @@ static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyO npy_intp dims[] = {(npy_intp)result.size() }; numpy::array_view pyresult(dims); - memcpy(pyresult.data(), &result[0], result.size() * sizeof(int)); + if (result.size() > 0) { + memcpy(pyresult.data(), &result[0], result.size() * sizeof(int)); + } return pyresult.pyobj(); }