Don't segfault if PHP Null is passed as this pointer (e.g.
Class_method(Null)) - give a PHP Error instead. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9166 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
080fa80ff3
commit
68e04737ed
2 changed files with 9 additions and 2 deletions
|
|
@ -1045,7 +1045,7 @@ public:
|
|||
// errors, or find a better way of dealing with _thisptr.
|
||||
// I would like, if objects are wrapped, to assume _thisptr is always
|
||||
// _this and not the first argument.
|
||||
// This may mean looking at Lang::memberfunctionhandler
|
||||
// This may mean looking at Language::memberfunctionHandler
|
||||
|
||||
for (i = 0, p = l; i < num_arguments; i++) {
|
||||
String * source;
|
||||
|
|
@ -1086,6 +1086,9 @@ public:
|
|||
Replaceall(tm,"$input", source);
|
||||
Setattr(p,"emit:input", source);
|
||||
Printf(f->code,"%s\n",tm);
|
||||
if (i == 0 && HashGetAttr(p, k_self)) {
|
||||
Printf(f->code,"\tif(!arg1) SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");\n");
|
||||
}
|
||||
p = Getattr(p,"tmap:in:next");
|
||||
if (i >= num_required) {
|
||||
Printf(f->code,"}\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue