diff options
author | Robert Schuster <theBohemian@gmx.net> | 2006-07-11 22:28:37 +0000 |
---|---|---|
committer | Robert Schuster <theBohemian@gmx.net> | 2006-07-11 22:28:37 +0000 |
commit | c1083c931b97403948b80882dddb28d400a3f2fc (patch) | |
tree | 4631eaf818e4a48195b1c278837501964b60f4c5 /native | |
parent | a01a0ab12fad2bf38b84c43404e5c3e7d432cdfd (diff) | |
download | classpath-c1083c931b97403948b80882dddb28d400a3f2fc.tar.gz |
2006-07-11 Robert Schuster <robertschuster@fsfe.org>
Fixes PR28350.
* native/jni/gconf-peer/GConfNativePeer.c:
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1set_1string):
Changed if-expression.
(Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1get_1string):
Added check for _value not being NULL.
Diffstat (limited to 'native')
-rw-r--r-- | native/jni/gconf-peer/GConfNativePeer.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/native/jni/gconf-peer/GConfNativePeer.c b/native/jni/gconf-peer/GConfNativePeer.c index bc8f78067..93d9a1e27 100644 --- a/native/jni/gconf-peer/GConfNativePeer.c +++ b/native/jni/gconf-peer/GConfNativePeer.c @@ -365,8 +365,13 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1get_1string return NULL; } - result = (*env)->NewStringUTF (env, _value); - g_free ((gpointer) _value); + // Even if Gconf reported no error it is possible that NULL was returned and + // it should be prevented to create a Java string from that value. + if (_value != NULL) + { + result = (*env)->NewStringUTF (env, _value); + g_free ((gpointer) _value); + } return result; } @@ -390,7 +395,7 @@ Java_gnu_java_util_prefs_gconf_GConfNativePeer_gconf_1client_1set_1string /* load an UTF string from the virtual machine. */ _key = JCL_jstring_to_cstring (env, key); _value = JCL_jstring_to_cstring (env, value); - if (_key == NULL && _value == NULL) + if (_key == NULL || _value == NULL) { return JNI_FALSE; } |