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

Commit 449c5887 authored by Eric Laurent's avatar Eric Laurent
Browse files

audiosystem JNI: check env pointer before use.

Bug: 18332935.
Change-Id: I1ec820f0282833e13444ec05d50da3ce70d19d8d
parent a0ecc714
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ JNIAudioPortCallback::~JNIAudioPortCallback()
{
    // remove global references
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    if (env == NULL) {
        return;
    }
    env->DeleteGlobalRef(mObject);
    env->DeleteGlobalRef(mClass);
}
@@ -167,7 +170,9 @@ JNIAudioPortCallback::~JNIAudioPortCallback()
void JNIAudioPortCallback::sendEvent(int event)
{
    JNIEnv *env = AndroidRuntime::getJNIEnv();

    if (env == NULL) {
        return;
    }
    env->CallStaticVoidMethod(mClass, gPostEventFromNative, mObject,
                              event, 0, 0, NULL);
    if (env->ExceptionCheck()) {