mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: use v8::Isolate::TryGetCurrent() in DumpJavaScriptBacktrace()
It was using Isolate::GetCurrent() which DCHECK on nullptr, even though what we wanted was to return early if it is nullptr. PR-URL: https://github.com/nodejs/node/pull/50518 Refs: https://github.com/nodejs/node/pull/50242 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
1 parent
aa8feea5f1
commit
b740324f7c
2 files changed
+5
-1
No files matched your search
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in new issue
Block a user