Fix fbjni's throwPendingJniExceptionAsCppException
Summary:
When checkjni is enabled and NDEBUG is not defined, fbjni may crash
when trying to handle Java exceptions. This is due to GetObjectRefType crashing
when there is a pending jni exception.
@@ -129,13 +129,13 @@ void throwPendingJniExceptionAsCppException() {
return;
}
- auto throwable = adopt_local(env->ExceptionOccurred());
+ auto throwable = env->ExceptionOccurred();
if (!throwable) {
throw std::runtime_error("Unable to get pending JNI exception.");
}
env->ExceptionClear();
- throw JniException(throwable);
+ throw JniException(adopt_local(throwable));
}
void throwCppExceptionIf(bool condition) {
