Check that the userdata pointer is not null, which happens when a user creates a...
authorIngo Ruhnke <grumbel@gmx.de>
Fri, 6 Mar 2009 01:56:24 +0000 (01:56 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Fri, 6 Mar 2009 01:56:24 +0000 (01:56 +0000)
SVN-Revision: 5845

tools/miniswig/create_wrapper.cpp

index a316631..29f35b2 100644 (file)
@@ -304,7 +304,7 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function)
     // retrieve pointer to class instance
     if(_class != 0 && function->type != Function::CONSTRUCTOR) {
         out << ind << "SQUserPointer data;\n";
-        out << ind << "if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0))) {\n";
+        out << ind << "if(SQ_FAILED(sq_getinstanceup(vm, 1, &data, 0)) || !data) {\n";
         out << ind << ind << "sq_throwerror(vm, _SC(\"'" << function->name << "' called without instance\"));\n";
         out << ind << ind << "return SQ_ERROR;\n";
         out << ind << "}\n";