diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-15 11:25:02 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-17 18:09:14 +0100 |
commit | 783c65ebc4143ed9afa723f26eaebdecf5f98691 (patch) | |
tree | 635afba4bcfa4a7447d0b7313ad3c859e6efcbd2 /src/api/callback.cc | |
parent | 586318aa9f70cdd0f5e0bc93b031ff68f572ed64 (diff) | |
download | android-node-v8-783c65ebc4143ed9afa723f26eaebdecf5f98691.tar.gz android-node-v8-783c65ebc4143ed9afa723f26eaebdecf5f98691.tar.bz2 android-node-v8-783c65ebc4143ed9afa723f26eaebdecf5f98691.zip |
src: add debug CHECKs against empty handles
These checks were useful while investigating other issues;
using empty `Local<>`s can be very un-debuggable, because that
typically does not lead to assertions with debugging information
but rather crashes based on accessing invalid memory.
PR-URL: https://github.com/nodejs/node/pull/26125
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/api/callback.cc')
-rw-r--r-- | src/api/callback.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/api/callback.cc b/src/api/callback.cc index 885134799f..4bcccb960c 100644 --- a/src/api/callback.cc +++ b/src/api/callback.cc @@ -139,6 +139,11 @@ MaybeLocal<Value> InternalMakeCallback(Environment* env, Local<Value> argv[], async_context asyncContext) { CHECK(!recv.IsEmpty()); +#ifdef DEBUG + for (int i = 0; i < argc; i++) + CHECK(!argv[i].IsEmpty()); +#endif + InternalCallbackScope scope(env, recv, asyncContext); if (scope.Failed()) { return MaybeLocal<Value>(); |