Add NULL check in updateProxyConfig

If the exclusionList was null in updateProxyConfig the VM would
crash when converting it to a UTF8 string. Avoid this by adding a
null check.

Change-Id: I0d8106fd54385bd9ae9c652a6c67d459a119cf2b
This commit is contained in:
Oscar Rydhé
2013-09-24 13:43:55 +02:00
committed by Takeshi Aimi
parent 7f8c70a1a4
commit e795ec73eb

View File

@@ -826,16 +826,19 @@ android_media_MediaPlayer_updateProxyConfig(
jstring exclusionListObj = (jstring)env->CallObjectMethod(
proxyProps, fields.proxyConfigGetExclusionList);
const char *exclusionList =
env->GetStringUTFChars(exclusionListObj, NULL);
if (host != NULL && exclusionListObj != NULL) {
thisplayer->updateProxyConfig(host, port, exclusionList);
}
const char *exclusionList = env->GetStringUTFChars(exclusionListObj, NULL);
if (exclusionList != NULL) {
env->ReleaseStringUTFChars(exclusionListObj, exclusionList);
exclusionList = NULL;
if (exclusionList != NULL) {
thisplayer->updateProxyConfig(host, port, exclusionList);
env->ReleaseStringUTFChars(exclusionListObj, exclusionList);
exclusionList = NULL;
} else {
thisplayer->updateProxyConfig(host, port, "");
}
} else if (host != NULL) {
thisplayer->updateProxyConfig(host, port, "");
}
if (host != NULL) {