Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a809ef9

Browse files
committed
Merge pull request #2993 from jkseppan/tri-null-pointer
Avoid a null-pointer dereference in _tri.cpp
2 parents 8429b1e + 613a5c6 commit a809ef9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/tri/_tri.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ TrapezoidMapTriFinder::find_many(const Py::Tuple& args)
13711371
PyArrayObject* y = (PyArrayObject*)PyArray_ContiguousFromObject(
13721372
args[1].ptr(), PyArray_DOUBLE, 0, 0);
13731373
bool ok = (x != 0 && y != 0 && PyArray_NDIM(x) == PyArray_NDIM(y));
1374-
int ndim = PyArray_NDIM(x);
1374+
int ndim = x == 0 ? 0 : PyArray_NDIM(x);
13751375
for (int i = 0; ok && i < ndim; ++i)
13761376
ok = (PyArray_DIM(x,i) == PyArray_DIM(y,i));
13771377

0 commit comments

Comments
 (0)