Added check for nil object being passed to SWIG_AsCharPtrAndSize. If a nil object is passed in then an error is returned.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8416 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
609d1e6a5c
commit
231d2a5f7b
1 changed files with 4 additions and 1 deletions
|
|
@ -6,7 +6,10 @@
|
|||
SWIGINTERN int
|
||||
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
||||
{
|
||||
if (TYPE(obj) == T_STRING) {
|
||||
/* Check for nil object first */
|
||||
if (obj == Qnil) {
|
||||
return SWIG_BADOBJ;
|
||||
} else if (TYPE(obj) == T_STRING) {
|
||||
char *cstr = rb_string_value_ptr(&(obj));
|
||||
size_t size = RSTRING(obj)->len + 1;
|
||||
if (cptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue