Skip to content

Commit

Permalink
fix: Use Isolate::TryGetCurrent()
Browse files Browse the repository at this point in the history
Isolate::GetCurrent() is not supposed to return null; if there is no
current isolate it's supposed to crash. Since we are checking for null
right after, I think we want TryGetCurrent() here.
  • Loading branch information
ptomato authored and edusperoni committed Jun 23, 2023
1 parent cd1d285 commit afe026a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test-app/runtime/src/main/cpp/com_tns_Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ extern "C" JNIEXPORT jint Java_com_tns_Runtime_getPointerSize(JNIEnv* env, jobje
}

extern "C" JNIEXPORT jint Java_com_tns_Runtime_getCurrentRuntimeId(JNIEnv* _env, jobject obj) {
Isolate* isolate = Isolate::GetCurrent();
Isolate* isolate = Isolate::TryGetCurrent();
if (isolate == nullptr) {
return -1;
}
Expand Down

0 comments on commit afe026a

Please sign in to comment.