diff --git a/src/env.cc b/src/env.cc index 74942f51d60869..1650027820a18f 100644 --- a/src/env.cc +++ b/src/env.cc @@ -547,7 +547,7 @@ void Environment::AssignToContext(Local context, // Used to retrieve bindings context->SetAlignedPointerInEmbedderData( ContextEmbedderIndex::kBindingDataStoreIndex, - realm->binding_data_store()); + realm != nullptr ? realm->binding_data_store() : nullptr); // ContextifyContexts will update this to a pointer to the native object. context->SetAlignedPointerInEmbedderData(