diff --git a/src/debug_utils.cc b/src/debug_utils.cc index 26f2a96831c137..d3436c62079e6a 100644 --- a/src/debug_utils.cc +++ b/src/debug_utils.cc @@ -319,7 +319,7 @@ void DumpNativeBacktrace(FILE* fp) { } void DumpJavaScriptBacktrace(FILE* fp) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = v8::Isolate::TryGetCurrent(); if (isolate == nullptr) { return; } diff --git a/test/cctest/test_util.cc b/test/cctest/test_util.cc index 5b83e07db3b7c2..c48803cff0337e 100644 --- a/test/cctest/test_util.cc +++ b/test/cctest/test_util.cc @@ -299,3 +299,7 @@ TEST(UtilTest, SPrintF) { const std::string with_zero = std::string("a") + '\0' + 'b'; EXPECT_EQ(SPrintF("%s", with_zero), with_zero); } + +TEST(UtilTest, DumpJavaScriptStackWithNoIsolate) { + node::DumpJavaScriptBacktrace(stderr); +}