From 6aabbd4a558f351bb2fbaf4d89b4846f91c6e702 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 17 Jun 2015 19:44:15 +0000 Subject: [PATCH] Correctly interpret SWIG return code of type check --- src/ifcwrap/utils/type_conversion.i | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ifcwrap/utils/type_conversion.i b/src/ifcwrap/utils/type_conversion.i index 0bc47d5b9d..12ce207b65 100644 --- a/src/ifcwrap/utils/type_conversion.i +++ b/src/ifcwrap/utils/type_conversion.i @@ -76,8 +76,7 @@ IfcParse::IfcLateBoundEntity* cast_pyobject(PyObject* element) { void *arg = 0; int res = SWIG_ConvertPtr(element, &arg, SWIGTYPE_p_IfcParse__IfcLateBoundEntity, 0); - if (!res) return static_cast(0); - return reinterpret_cast(arg); + return static_cast(SWIG_IsOK(res) ? arg : 0); } template