diff --git a/driver/js/src/modules/contextify_module.cc b/driver/js/src/modules/contextify_module.cc index a0767dfdc7c..b45b830883b 100644 --- a/driver/js/src/modules/contextify_module.cc +++ b/driver/js/src/modules/contextify_module.cc @@ -100,8 +100,14 @@ void ContextifyModule::LoadUntrustedContent(CallbackInfo& info, void* data) { auto scope_wrapper = reinterpret_cast(std::any_cast(info.GetSlot())); auto scope = scope_wrapper->scope.lock(); FOOTSTONE_CHECK(scope); + if (!scope) { + return; + } auto context = scope->GetContext(); FOOTSTONE_CHECK(context); + if (!context) { + return; + } string_view uri; if (!context->GetValueString(info[0], &uri)) { info.GetExceptionValue()->Set(context, "The first argument must be non-empty string."); @@ -207,6 +213,9 @@ void ContextifyModule::LoadUntrustedContent(CallbackInfo& info, void* data) { auto loader = scope->GetUriLoader().lock(); FOOTSTONE_CHECK(loader); + if (!loader) { + return; + } loader->RequestUntrustedContent(uri, {}, cb); info.GetReturnValue()->SetUndefined();