Skip to content

Commit 649faa0

Browse files
author
Jean-Luc Pons
committed
Raise exception in case off memory allocation error
1 parent c3cbb76 commit 649faa0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

atgpu/PyInterface.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ static PyObject *at_gpupass(PyObject *self, PyObject *args, PyObject *kwargs) {
308308

309309
npy_intp outdims[4] = {6,(npy_intp)(num_particles),num_refs,num_turns};
310310
PyObject *rout = PyArray_EMPTY(4, outdims, floatType, 1);
311+
if( rout==nullptr )
312+
return PyErr_Format(PyExc_RuntimeError,"Not enough memory while trying to allocate particle output coordinates");
311313
AT_FLOAT *drout = (AT_FLOAT *)PyArray_DATA((PyArrayObject *)rout);
312314

313315
if(losses) {

0 commit comments

Comments
 (0)