From ac74a487cc0ecef51deabf48db7742c061528586 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Fri, 30 Jul 2021 14:45:15 +0200 Subject: [PATCH] types: add safe guard --- include/eigenpy/user-type.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/eigenpy/user-type.hpp b/include/eigenpy/user-type.hpp index 0e75214..50fb676 100644 --- a/include/eigenpy/user-type.hpp +++ b/include/eigenpy/user-type.hpp @@ -256,6 +256,8 @@ namespace eigenpy // PyTypeObject * to_py_type = Register::getPyType<To>(); int to_typenum = Register::getTypeCode<To>(); + assert(to_typenum >= 0 && "to_typenum is not valid"); + assert(from_array_descr != NULL && "to_typenum is not valid"); if(PyArray_RegisterCastFunc(from_array_descr, to_typenum, -- GitLab