r15987 - gnucash/trunk/src/engine - Allow NULL pointers when calling xaccAccountGetFullName. Fixes #432314.

David Hampton hampton at cvs.gnucash.org
Sun Apr 22 14:30:48 EDT 2007


Author: hampton
Date: 2007-04-22 14:30:48 -0400 (Sun, 22 Apr 2007)
New Revision: 15987
Trac: http://svn.gnucash.org/trac/changeset/15987

Modified:
   gnucash/trunk/src/engine/Account.c
Log:
Allow NULL pointers when calling xaccAccountGetFullName. Fixes #432314.


Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c	2007-04-22 16:30:55 UTC (rev 15986)
+++ gnucash/trunk/src/engine/Account.c	2007-04-22 18:30:48 UTC (rev 15987)
@@ -2774,8 +2774,14 @@
   gchar **names;
   int level;
 
+  /* So much for hardening the API. Too many callers to this function don't
+   * bother to check if they have a non-NULL pointer before calling. */
+  if (NULL == account)
+      return g_strdup("");
+
   /* errors */
   g_return_val_if_fail(GNC_IS_ACCOUNT(account), g_strdup(""));
+
   /* optimizations */
   priv = GET_PRIVATE(account);
   if (!priv->parent)



More information about the gnucash-changes mailing list