Java/Exception: simplify RethrowException()

This commit is contained in:
Max Kellermann 2021-03-28 13:55:38 +02:00 committed by Max Kellermann
parent a237db556a
commit b59170b702

View File

@ -39,12 +39,10 @@ Java::Exception::Exception(JNIEnv *env, jthrowable e) noexcept
void void
Java::RethrowException(JNIEnv *env) Java::RethrowException(JNIEnv *env)
{ {
jthrowable exception = env->ExceptionOccurred(); LocalRef<jthrowable> exception{env, env->ExceptionOccurred()};
if (exception == nullptr) if (!exception)
return; return;
LocalRef<jthrowable> ref(env, exception);
env->ExceptionClear(); env->ExceptionClear();
throw Exception(env, exception); throw Exception(env, exception);
} }