From 2ef1b70897cbc86afe4cde7350fe6d2a801c4966 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 28 Mar 2017 17:19:14 +0900 Subject: [PATCH] Fix crash happened in UvRunOnce --- atom/common/node_bindings.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 314a7b9c0330..f4696773dad6 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -232,6 +232,12 @@ void NodeBindings::RunMessageLoop() { void NodeBindings::UvRunOnce() { node::Environment* env = uv_env(); + // When doing navigation without restarting renderer process, it may happen + // that the node environment is destroyed but the message loop is still there. + // In this case we should not run uv loop. + if (!env) + return; + // Use Locker in browser process. mate::Locker locker(env->isolate()); v8::HandleScope handle_scope(env->isolate());