Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0aa0f12 authored by Aurimas Liutikas's avatar Aurimas Liutikas
Browse files

Clear exceptions before calling IsInstanceOf.

Test: None
Change-Id: Iac94f4d7c489c1062a757919fd12a343b8abd001
parent 3b75a823
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -157,13 +157,15 @@ status_t JHwBinder::onTransact(
    if (env->ExceptionCheck()) {
        jthrowable excep = env->ExceptionOccurred();
        env->ExceptionDescribe();
        env->ExceptionClear();

        // It is illegal to call IsInstanceOf if there is a pending exception.
        // Attempting to do so results in a JniAbort which crashes the entire process.
        if (env->IsInstanceOf(excep, gErrorClass)) {
            /* It's an error */
            LOG(ERROR) << "Forcefully exiting";
            exit(1);
        } else {
            env->ExceptionClear();
            LOG(ERROR) << "Uncaught exception!";
        }