Skip to content

Commit

Permalink
Merge pull request matplotlib#2993 from jkseppan/tri-null-pointer
Browse files Browse the repository at this point in the history
Avoid a null-pointer dereference in _tri.cpp
  • Loading branch information
ianthomas23 committed Apr 22, 2014
2 parents 8429b1e + 613a5c6 commit a809ef9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/matplotlib/tri/_tri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ TrapezoidMapTriFinder::find_many(const Py::Tuple& args)
PyArrayObject* y = (PyArrayObject*)PyArray_ContiguousFromObject(
args[1].ptr(), PyArray_DOUBLE, 0, 0);
bool ok = (x != 0 && y != 0 && PyArray_NDIM(x) == PyArray_NDIM(y));
int ndim = PyArray_NDIM(x);
int ndim = x == 0 ? 0 : PyArray_NDIM(x);
for (int i = 0; ok && i < ndim; ++i)
ok = (PyArray_DIM(x,i) == PyArray_DIM(y,i));

Expand Down

0 comments on commit a809ef9

Please sign in to comment.