From a7c7477bcf7de29f0949f3ba3abd2b4cb6ff31d6 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 9 Jan 2006 23:14:08 +0000 Subject: [PATCH] fix for director_exception.i in ruby, ie, null ref in a 'Type' typemap is considered a TypeError git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8336 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/typemaps/ptrtypes.swg | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SWIG/Lib/typemaps/ptrtypes.swg b/SWIG/Lib/typemaps/ptrtypes.swg index 524578543..4c921feec 100644 --- a/SWIG/Lib/typemaps/ptrtypes.swg +++ b/SWIG/Lib/typemaps/ptrtypes.swg @@ -28,7 +28,9 @@ %typemap(in,fragment=frag) Type { Type *ptr = (Type *)0; int res = asptr_meth($input, &ptr); - if (!SWIG_IsOK(res) || !ptr) { %argument_fail(res, "$type", $symname, $argnum); } + if (!SWIG_IsOK(res) || !ptr) { + %argument_fail((ptr ? res : SWIG_TypeError), "$type", $symname, $argnum); + } $1 = *ptr; if (SWIG_IsNewObj(res)) %delete(ptr); } @@ -51,7 +53,9 @@ %typemap(varin,fragment=frag) Type { Type *ptr = (Type *)0; int res = asptr_meth($input, &ptr); - if (!SWIG_IsOK(res) || !ptr) { %variable_fail(res, "$type", "$name"); } + if (!SWIG_IsOK(res) || !ptr) { + %variable_fail((ptr ? res : SWIG_TypeError), "$type", "$name"); + } $1 = *ptr; if (SWIG_IsNewObj(res)) %delete(ptr); } @@ -65,7 +69,7 @@ Type *optr = 0; int ores = $input ? asptr_meth($input, &optr) : 0; if (!SWIG_IsOK(ores) || !optr) { - %dirout_fail(ores,"$type"); + %dirout_fail((optr ? ores : SWIG_TypeError),"$type"); } temp = *optr; $result = &temp; @@ -76,7 +80,7 @@ Type *optr = 0; int ores = asptr_meth($input, &optr); if (!SWIG_IsOK(ores) || !optr) { - %dirout_fail(ores,"$type"); + %dirout_fail((optr ? ores : SWIG_TypeError),"$type"); } $result = *optr; if (SWIG_IsNewObj(ores)) %delete(optr);