r15909 - gnucash/trunk/src/import-export - Fix NULL-%s-printf in gnc_import_select_account. Fixes #430130.

Andreas Köhler andi5 at cvs.gnucash.org
Mon Apr 16 04:26:19 EDT 2007


Author: andi5
Date: 2007-04-16 04:26:18 -0400 (Mon, 16 Apr 2007)
New Revision: 15909
Trac: http://svn.gnucash.org/trac/changeset/15909

Modified:
   gnucash/trunk/src/import-export/import-account-matcher.c
Log:
Fix NULL-%s-printf in gnc_import_select_account.  Fixes #430130.


Modified: gnucash/trunk/src/import-export/import-account-matcher.c
===================================================================
--- gnucash/trunk/src/import-export/import-account-matcher.c	2007-04-16 04:54:20 UTC (rev 15908)
+++ gnucash/trunk/src/import-export/import-account-matcher.c	2007-04-16 08:26:18 UTC (rev 15909)
@@ -152,6 +152,7 @@
   struct _accountpickerdialog * picker;
   gint response;
   Account * retval = NULL;
+  const gchar *retval_name = NULL;
   GladeXML *xml;
   GtkWidget * online_id_label, *button;
   gchar account_description_text[ACCOUNT_DESCRIPTION_MAX_SIZE] = "";
@@ -225,7 +226,9 @@
 	switch (response) {
 	 case GTK_RESPONSE_OK:
 	  retval = gnc_tree_view_account_get_selected_account(picker->account_tree);
-	  DEBUG("Selected account %p, %s", retval, xaccAccountGetName(retval));
+	  retval_name = xaccAccountGetName(retval);
+	  DEBUG("Selected account %p, %s", retval,
+		retval_name ? retval_name : "(null)");
 
 	  /* See if the selected account is a placeholder. */
 	  if (xaccAccountGetPlaceholder (retval)) {
@@ -233,7 +236,7 @@
 	      (picker->dialog,
 	       _("The account %s is a placeholder account and does not allow "
 		 "transactions. Please choose a different account."),
-	       xaccAccountGetName (retval));
+	       retval_name ? retval_name : "(null)");
 	    response = GNC_RESPONSE_NEW;
 	    break;
 	  }
@@ -256,6 +259,7 @@
     }
   else
     {
+      retval_name = xaccAccountGetName(retval);
       ok_pressed_retval=TRUE; /* There was no dialog involved, so the computer "pressed" ok */
     }   
   /*FIXME: DEBUG("WRITEME: gnc_import_select_account() Here we should check if account type is compatible, currency matches, etc.\n"); */
@@ -265,7 +269,7 @@
     {
       *ok_pressed=ok_pressed_retval;
     }
-  LEAVE("Selected account %p, %s", retval, xaccAccountGetName(retval));
+  LEAVE("Selected account %p, %s", retval, retval_name ? retval_name : "(null)");
   return retval;
 }
 /**@}*/



More information about the gnucash-changes mailing list