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

Commit 67a12184 authored by Mike J. Chen's avatar Mike J. Chen
Browse files

Fix a crash case



There's a runtime check for a bad argument, but it is
after the usage of the bad argument.  Move the usage
after the check.

Bug 8687716

Change-Id: Iddfa457951bac69b436a430cda21b5d7a563107b
Signed-off-by: default avatarMike J. Chen <mjchen@google.com>
parent 49906f17
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -164,17 +164,18 @@ static void captureCallback(void* user,

    visualizer_callback_cookie *callbackInfo = (visualizer_callback_cookie *)user;
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    AutoMutex lock(&callbackInfo->callback_data_lock);

    if (!user || !env) {
        ALOGW("captureCallback error user %p, env %p", user, env);
        return;
    }

    ALOGV("captureCallback: callbackInfo %p, visualizer_ref %p visualizer_class %p",
            callbackInfo,
            callbackInfo->visualizer_ref,
            callbackInfo->visualizer_class);

    if (!user || !env) {
        ALOGW("captureCallback error user %p, env %p", user, env);
        return;
    }
    AutoMutex lock(&callbackInfo->callback_data_lock);

    if (waveformSize != 0 && waveform != NULL) {
        jbyteArray jArray;