Hi,
this patch fixes PR28350 for me.

Ok to commit?

ChangeLog:

2006-07-11  Robert Schuster  <[EMAIL PROTECTED]>

        * 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.

Function name doesnt fit into 80 columns ... hmm.

cya
Robert
Index: native/jni/gconf-peer/GConfNativePeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gconf-peer/GConfNativePeer.c,v
retrieving revision 1.3
diff -u -r1.3 GConfNativePeer.c
--- native/jni/gconf-peer/GConfNativePeer.c	8 Jul 2006 22:28:16 -0000	1.3
+++ native/jni/gconf-peer/GConfNativePeer.c	11 Jul 2006 20:18:16 -0000
@@ -365,8 +365,13 @@
       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 @@
   /* 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;
     }

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to