summaryrefslogtreecommitdiff
path: root/Lib/r
diff options
context:
space:
mode:
authorJoseph C Wang <joequant@gmail.com>2017-11-24 23:43:02 +0800
committerJoseph C Wang <joequant@gmail.com>2017-11-24 23:43:02 +0800
commit0b97170f1d9bb025facd501d21566b814d80d46d (patch)
treedf686a1e2feb571f6ea4b7722309116b43490b99 /Lib/r
parent7d6808daabef22143c6d417759910ccc059e8d21 (diff)
downloadswig-0b97170f1d9bb025facd501d21566b814d80d46d.tar.gz
fix #1124 - return R_NilValue for null pointer objects
This fixes #1124 and returns R_NilValue for null pointer objects
Diffstat (limited to 'Lib/r')
-rw-r--r--Lib/r/rrun.swg3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/r/rrun.swg b/Lib/r/rrun.swg
index bec981546..7a94c28be 100644
--- a/Lib/r/rrun.swg
+++ b/Lib/r/rrun.swg
@@ -260,6 +260,9 @@ AddOutputArgToReturn(int pos, SEXP value, const char *name, SEXP output)
/* Create a new pointer object */
SWIGRUNTIMEINLINE SEXP
SWIG_R_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+ if (!ptr) {
+ return R_NilValue;
+ }
SEXP rptr = R_MakeExternalPtr(ptr,
R_MakeExternalPtr(type, R_NilValue, R_NilValue), R_NilValue);
SET_S4_OBJECT(rptr);