diff --git a/include/v8.h b/include/v8.h index c4536d6a7c..8b2f39d123 100644 --- a/include/v8.h +++ b/include/v8.h @@ -439,7 +439,7 @@ class MaybeLocal { return !IsEmpty(); } - // Will crash if the MaybeLocal<> is empty. + // Will crash when checks are enabled if the MaybeLocal<> is empty. V8_INLINE Local ToLocalChecked(); template @@ -6909,7 +6909,9 @@ Local Eternal::Get(Isolate* isolate) { template Local MaybeLocal::ToLocalChecked() { - if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty(); +#ifdef V8_ENABLE_CHECKS + if (val_ == nullptr) V8::ToLocalEmpty(); +#endif return Local(val_); }