[Gnucash-changes] r13083 - gnucash/trunk - Don't call g_utf8_strlen with a NULL pointer.

David Hampton hampton at cvs.gnucash.org
Thu Feb 2 19:47:40 EST 2006


Author: hampton
Date: 2006-02-02 19:47:40 -0500 (Thu, 02 Feb 2006)
New Revision: 13083
Trac: http://svn.gnucash.org/trac/changeset/13083

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/register/register-core/numcell.c
Log:
Don't call g_utf8_strlen with a NULL pointer.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-03 00:31:50 UTC (rev 13082)
+++ gnucash/trunk/ChangeLog	2006-02-03 00:47:40 UTC (rev 13083)
@@ -1,5 +1,8 @@
 2006-02-02  David Hampton  <hampton at employees.org>
 
+	* src/register/register-core/numcell.c: Don't call g_utf8_strlen
+	with a NULL pointer.  Fixes 329556.
+
 	* src/gnome-utils/gnc-tree-model-commodity.c:
 	* src/gnome-utils/gnc-tree-model-account.c:
 	* src/gnome-utils/gnc-tree-model-price.c: Better handling in the

Modified: gnucash/trunk/src/register/register-core/numcell.c
===================================================================
--- gnucash/trunk/src/register/register-core/numcell.c	2006-02-03 00:31:50 UTC (rev 13082)
+++ gnucash/trunk/src/register/register-core/numcell.c	2006-02-03 00:47:40 UTC (rev 13083)
@@ -88,10 +88,17 @@
   gunichar uc;
   glong change_chars;
     
+  if (change == NULL) /* if we are deleting */
+    /* then just accept the proposed change */
+  {
+    gnc_basic_cell_set_value_internal (&cell->cell, newval);
+    return;
+  }
+
   change_chars = g_utf8_strlen (change, -1);
 
-  if ((change == NULL) || (change_chars == 0) || /* if we are deleting       */
-      (change_chars > 1))                        /* or entering > 1 char     */
+  if ((change_chars == 0) || /* if we are deleting       */
+      (change_chars > 1))    /* or entering > 1 char     */
     /* then just accept the proposed change */
   {
     gnc_basic_cell_set_value_internal (&cell->cell, newval);



More information about the gnucash-changes mailing list