Skip to content

Commit cdf33ff

Browse files
committed
Add null guards
1 parent 08b203f commit cdf33ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

atom/renderer/atom_isolated_world.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ node::Environment* AtomIsolatedWorld::env_ = nullptr;
1515
AtomIsolatedWorld::AtomIsolatedWorld(NodeBindings* node_bindings) :
1616
v8::Extension("AtomIsolatedWorld", "native function SetupNode();") {
1717
node_bindings_ = node_bindings;
18-
env_ = nullptr;
1918
}
2019

2120
AtomIsolatedWorld::~AtomIsolatedWorld() {
2221
node_bindings_ = nullptr;
23-
env_ = nullptr;
2422
}
2523

2624
node::Environment* AtomIsolatedWorld::CreateEnvironment(
2725
content::RenderFrame* frame) {
26+
env_ = nullptr;
2827
blink::WebScriptSource source("SetupNode()");
2928
frame->GetWebFrame()->executeScriptInIsolatedWorld(
3029
1,
@@ -46,8 +45,9 @@ v8::Local<v8::FunctionTemplate> AtomIsolatedWorld::GetNativeFunctionTemplate(
4645
// static
4746
void AtomIsolatedWorld::SetupNode(
4847
const v8::FunctionCallbackInfo<v8::Value>& args) {
49-
env_ = node_bindings_->CreateEnvironment(
50-
args.GetIsolate()->GetCurrentContext());
48+
if (node_bindings_ != nullptr)
49+
env_ = node_bindings_->CreateEnvironment(
50+
args.GetIsolate()->GetCurrentContext());
5151
}
5252

5353
// static

0 commit comments

Comments
 (0)