handle the case where the value returned by linphone_proxy_config_get_custom_header() is NULL

This commit is contained in:
Simon Morlat 2016-06-01 19:51:20 +02:00
parent c62793c280
commit c047fa514a

View file

@ -4707,9 +4707,9 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setCustomH
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong ptr, jstring jname) {
const char *name = jname ? env->GetStringUTFChars(jname, NULL) : NULL;
jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_custom_header((LinphoneProxyConfig *)ptr, name));
const char *value = linphone_proxy_config_get_custom_header((LinphoneProxyConfig *)ptr, name);
if (jname) env->ReleaseStringUTFChars(jname, name);
return jvalue;
return value ? env->NewStringUTF(value) : NULL;
}