From b59170b702ad1b5001f03d573a0db23a5f5d36ff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Mar 2021 13:55:38 +0200 Subject: [PATCH] Java/Exception: simplify RethrowException() --- src/java/Exception.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/java/Exception.cxx b/src/java/Exception.cxx index 1bd4c6533..118353ca8 100644 --- a/src/java/Exception.cxx +++ b/src/java/Exception.cxx @@ -39,12 +39,10 @@ Java::Exception::Exception(JNIEnv *env, jthrowable e) noexcept void Java::RethrowException(JNIEnv *env) { - jthrowable exception = env->ExceptionOccurred(); - if (exception == nullptr) + LocalRef exception{env, env->ExceptionOccurred()}; + if (!exception) return; - LocalRef ref(env, exception); - env->ExceptionClear(); throw Exception(env, exception); }