We must also check if the asFoo() on the managed object succeeds
before calling the method.
Change-Id: I26ed56fec044b54221ca44e7789a2e9d0acec9ec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
out.write(" QV4::Object *thatObject = ctx->thisObject.asObject();\n")
out.write(" if (!thatObject)\n")
out.write(" ctx->throwTypeError();\n")
- out.write(" return thatObject->as%s()->%s_%s(ctx);\n" % (parsedClass.managedTypeName(), self.methodPrefix, self.name))
+ out.write(" %s *o = thatObject->as%s();\n" % (parsedClass.name, parsedClass.managedTypeName()))
+ out.write(" if (!o)\n")
+ out.write(" ctx->throwTypeError();\n")
+ out.write(" return o->%s_%s(ctx);\n" % (self.methodPrefix, self.name))
out.write("}\n")
out.write("\n")