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

Commit 43431e82 authored by Vince Leung's avatar Vince Leung
Browse files

performance: prevent crash due to missing symbol

Crashes can occur when the symbols for PerfLock
cannot be linked properly before invoking.
Add an extra check prior to calling the function.

Change-Id: I03cbf7aff21573296b0e1221d4269c604e2c30a7
parent 03e69020
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -124,7 +124,9 @@ org_codeaurora_performance_native_perf_lock_acq(JNIEnv *env, jobject clazz, jint
    if (perf_lock_acq == NULL) {
        org_codeaurora_performance_native_init();
    }
    if (perf_lock_acq) {
        ret = (*perf_lock_acq)(handle, duration, buf, listlen);
    }
    pthread_mutex_unlock(&dl_mutex);
    return ret;
}
@@ -137,7 +139,9 @@ org_codeaurora_performance_native_perf_lock_rel(JNIEnv *env, jobject clazz, jint
    if (perf_lock_rel == NULL) {
        org_codeaurora_performance_native_init();
    }
    if (perf_lock_rel) {
        ret = (*perf_lock_rel)(handle);
    }
    pthread_mutex_unlock(&dl_mutex);
    return ret;
}