From 63de6bd0d2ebf5178917e848324893dc10956bc1 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 16 Nov 2010 10:14:01 +0000 Subject: [PATCH] Correction of downcast bug. --- src/MEDCoupling_Swig/MEDCouplingTypemaps.i | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index b5d9b2a29..d1af65ba8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -23,11 +23,18 @@ static PyObject* convertMesh(ParaMEDMEM::MEDCouplingMesh* mesh, int owner) { - PyObject *ret; + PyObject *ret=0; if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingExtrudedMesh,owner); + if(dynamic_cast(mesh)) + ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingCMesh,owner); + if(!ret) + { + PyErr_SetString(PyExc_TypeError,"Not recognized type of mesh on downcast !"); + PyErr_Print(); + } return ret; } -- 2.39.2