summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-11-12 11:07:48 -0800
committerEric Laurent <elaurent@google.com>2014-11-12 11:07:48 -0800
commit449c5887101047d187a55217ced6d8a5c98fb367 (patch)
treef28877c90cbb98c2c960038e1cc2ffbff4132c0d /core/jni
parenta0ecc714c3aeaaa05649e0ab1f054cc8efbb126f (diff)
downloadframeworks_base-449c5887101047d187a55217ced6d8a5c98fb367.zip
frameworks_base-449c5887101047d187a55217ced6d8a5c98fb367.tar.gz
frameworks_base-449c5887101047d187a55217ced6d8a5c98fb367.tar.bz2
audiosystem JNI: check env pointer before use.
Bug: 18332935. Change-Id: I1ec820f0282833e13444ec05d50da3ce70d19d8d
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_media_AudioSystem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index f099289..4b4b367 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -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()) {