diff options
-rwxr-xr-x | src/embind/embind.js | 5 |
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'); |