diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/embind/embind.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 3eadb85f..4821c77b 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -1525,9 +1525,12 @@ function downcastPointer(ptr, ptrClass, desiredClass) { if (undefined === desiredClass.baseClass) { return null; // no conversion } - // O(depth) stack space used - return desiredClass.downcast( - downcastPointer(ptr, ptrClass, desiredClass.baseClass)); + + var rv = downcastPointer(ptr, ptrClass, desiredClass.baseClass); + if (rv === null) { + return null; + } + return desiredClass.downcast(rv); } function upcastPointer(ptr, ptrClass, desiredClass) { |