From a7e72609cffa56aadf00f951d3b8145be197cf1c Mon Sep 17 00:00:00 2001 From: David Hampton Date: Thu, 6 Jul 2006 05:18:36 +0000 Subject: [PATCH] When creating accounts from the register, fix the name parsing logic to correctly handle the case where the first new account will be the first child of its parent. Fixes #345771. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14468 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 7 +++++++ src/gnome-utils/dialog-account.c | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ae8ef8556..ad5232beca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-06 David Hampton + + * src/gnome-utils/dialog-account.c: When creating accounts from + the register, fix the name parsing logic to correctly handle the + case where the first new account will be the first child of its + parent. Fixes #345771. + 2006-07-04 Derek Atkins * src/core-utils/gnc-glib-utils.h diff --git a/src/gnome-utils/dialog-account.c b/src/gnome-utils/dialog-account.c index fff37f75da..a31a6f453f 100644 --- a/src/gnome-utils/dialog-account.c +++ b/src/gnome-utils/dialog-account.c @@ -1555,10 +1555,14 @@ gnc_split_account_name (const char *in_name, Account **base_account) GList *list, *node; group = gnc_get_current_group (); - list = xaccGroupGetAccountList (group); names = g_strsplit(in_name, gnc_get_account_separator_string(), -1); for (ptr = names; *ptr; ptr++) { + /* Stop if there are no children at the current level. */ + if (group == NULL) + break; + list = xaccGroupGetAccountList (group); + /* Look for the first name in the children. */ for (node = list; node; node = g_list_next(node)) { account = node->data; @@ -1575,9 +1579,6 @@ gnc_split_account_name (const char *in_name, Account **base_account) break; group = xaccAccountGetChildren (account); - if (group == NULL) - break; - list = xaccGroupGetAccountList (group); } out_names = g_strdupv(ptr);