From 16d283bcb47f646d34d8f5c8300b7de68a8c1761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benoit=20Gr=C3=A9goire?= Date: Thu, 3 Apr 2003 16:06:05 +0000 Subject: [PATCH] =?UTF-8?q?2003-04-03=20=20Benoit=20Gr=EF=BF=BDgoire=20=20?= =?UTF-8?q??= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/import-export/import-commodity-matcher.c: Fix debian bug #187061 Crash during import of investment accounts. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8181 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 +++++ src/import-export/import-commodity-matcher.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc8f96ce72..96c0e1b00b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-04-03 Benoit Grégoire + + * src/import-export/import-commodity-matcher.c: Fix debian bug #187061 + Crash during import of investment accounts. + 2003-04-02 Benoit Grégoire * po/POTFILES.in, diff --git a/src/import-export/import-commodity-matcher.c b/src/import-export/import-commodity-matcher.c index 7d2b83f27d..9b0b057bd1 100755 --- a/src/import-export/import-commodity-matcher.c +++ b/src/import-export/import-commodity-matcher.c @@ -93,7 +93,9 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code, tmp_commodity=commodity_list->data; DEBUG("Looking at commodity %s",gnc_commodity_get_fullname(tmp_commodity)); - if(strncmp(gnc_commodity_get_exchange_code(tmp_commodity),exchange_code,strlen(exchange_code))==0) + if(gnc_commodity_get_exchange_code(tmp_commodity)!=NULL && + exchange_code != NULL && + strncmp(gnc_commodity_get_exchange_code(tmp_commodity),exchange_code,strlen(exchange_code))==0) { retval = tmp_commodity; DEBUG("Commodity %s%s",gnc_commodity_get_fullname(retval)," matches."); @@ -115,14 +117,17 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code, { retval=gnc_ui_select_commodity_modal_full(NULL, NULL, - _("Please select a commodity to match the following exchange code.\nPlease note that the exchange code of the commodity you select will be overwritten."), + _("Please select a commodity to match the following exchange code.\nPlease note that the exchange code of the commodity you select will be overwritten.\n"), exchange_code, default_fullname, default_mnemonic, 0); } - if (retval != NULL&&(strncmp(gnc_commodity_get_exchange_code(retval),exchange_code,strlen(exchange_code))!=0)) + if (retval != NULL&& + gnc_commodity_get_exchange_code(tmp_commodity)!=NULL && + exchange_code != NULL && + (strncmp(gnc_commodity_get_exchange_code(retval),exchange_code,strlen(exchange_code))!=0)) { gnc_commodity_set_exchange_code(retval, exchange_code);