diff --git a/src/env.cc b/src/env.cc index 56f4344d9e1b5d..64b8fa6e34cc28 100644 --- a/src/env.cc +++ b/src/env.cc @@ -575,7 +575,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(