diff options
author | Mike J. Chen <mjchen@google.com> | 2013-04-26 12:34:52 -0700 |
---|---|---|
committer | Mike J. Chen <mjchen@google.com> | 2013-04-26 12:39:04 -0700 |
commit | 67a12184776605b6e6ddc01ca91b533a2e37a40b (patch) | |
tree | 6af967d95e0b99b79efddc993270811328f547ea /media | |
parent | 49906f17059afcd862ef8bc3b456a6ffef5ef40e (diff) | |
download | frameworks_base-67a12184776605b6e6ddc01ca91b533a2e37a40b.zip frameworks_base-67a12184776605b6e6ddc01ca91b533a2e37a40b.tar.gz frameworks_base-67a12184776605b6e6ddc01ca91b533a2e37a40b.tar.bz2 |
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: Mike J. Chen <mjchen@google.com>
Diffstat (limited to 'media')
-rw-r--r-- | media/jni/audioeffect/android_media_Visualizer.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp index c2655c7..4d77cfd 100644 --- a/media/jni/audioeffect/android_media_Visualizer.cpp +++ b/media/jni/audioeffect/android_media_Visualizer.cpp @@ -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; |