summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-07 18:14:59 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:25:21 +0300
commit138b83710a8fa76b2d1585eca5a8a293776c835f (patch)
treeb98e722c82078559a7f47e3573ebffe325794036
parent3be57ee250e6971708f60615ca26c3eba6ef80da (diff)
Improve error output if calling emscripten methods with invalid 'this'
-rwxr-xr-xsrc/embind/embind.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 940abaaa..87512dda 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -869,8 +869,11 @@ function upcastPointer(ptr, ptrClass, desiredClass) {
}
function validateThis(this_, classType, humanName) {
+ if (!(this_ instanceof Object)) {
+ throwBindingError(humanName + ' with invalid "this": ' + this_);
+ }
if (!(this_ instanceof classType.constructor)) {
- throwBindingError(humanName + ' incompatible with object of type ' + this_.constructor.name);
+ throwBindingError(humanName + ' incompatible with "this" of type ' + this_.constructor.name);
}
if (!this_.$$.ptr) {
throwBindingError('cannot call emscripten binding method ' + humanName + ' on deleted object');