# HG changeset patch # User John W. Eaton # Date 1437070787 14400 # Node ID b9bd8786d3109b5541bfa1c28dbb6db7bd278459 # Parent bf92a14c0e7638c1f5001ab39a14196a32bc7da4 fix incompatibility in mxCreateNumericArray (bug #45319) * mex.cc (mxArray_matlab::mxArray_matlab): Create empty array if ndims_arg is 0. If ndims_arg < 2, initialize dims to [1, 1]. diff --git a/libinterp/corefcn/mex.cc b/libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc +++ b/libinterp/corefcn/mex.cc @@ -615,11 +615,16 @@ ndims (ndims_arg < 2 ? 2 : ndims_arg), dims (static_cast (mxArray::malloc (ndims * sizeof (mwSize)))) { - if (ndims_arg < 2) + if (ndims_arg == 0) { dims[0] = 0; dims[1] = 0; } + else if (ndims_arg < 2) + { + dims[0] = 1; + dims[1] = 1; + } for (mwIndex i = 0; i < ndims_arg; i++) dims[i] = dims_arg[i];