diff options
-rwxr-xr-x | src/embind/embind.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index ed659a2b..470b03f7 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -887,6 +887,9 @@ function __embind_register_class_method( argTypes = argTypes.slice(1); var humanName = classType.name + '.' + methodName; classType.Handle.prototype[methodName] = function() { + if (!(this instanceof classType.constructor)) { + throwBindingError(humanName + ' incompatible with object of type ' + this.constructor.name); + } if (!this.$$.ptr) { throwBindingError('cannot call emscripten binding method ' + humanName + ' on deleted object'); } |