[Gnucash-changes] r13502 - gnucash/trunk - Fix crash when "clear"
is chosen but no matching transaction is
Christian Stimming
cstim at cvs.gnucash.org
Mon Mar 6 16:31:08 EST 2006
Author: cstim
Date: 2006-03-06 16:31:08 -0500 (Mon, 06 Mar 2006)
New Revision: 13502
Trac: http://svn.gnucash.org/trac/changeset/13502
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/import-export/import-backend.c
Log:
Fix crash when "clear" is chosen but no matching transaction is
selected. Now those imported transactions will silently be
ignored. #317917.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-03-06 21:01:27 UTC (rev 13501)
+++ gnucash/trunk/ChangeLog 2006-03-06 21:31:08 UTC (rev 13502)
@@ -1,3 +1,9 @@
+2006-03-06 Christian Stimming <stimming at tuhh.de>
+
+ * src/import-export/import-backend.c: Fix crash when "clear" is
+ chosen but no matching transaction is selected. Now those imported
+ transactions will silently be ignored. #317917.
+
2006-03-05 Chris Lyttle <chris at wilddev.net>
* NEWS: Added some text about the release.
Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c 2006-03-06 21:01:27 UTC (rev 13501)
+++ gnucash/trunk/src/import-export/import-backend.c 2006-03-06 21:31:08 UTC (rev 13502)
@@ -890,11 +890,19 @@
xaccTransCommitEdit
(gnc_import_TransInfo_get_trans (trans_info));
break;
- case GNCImport_CLEAR:
+ case GNCImport_CLEAR: {
+ GNCImportMatchInfo *selected_match =
+ gnc_import_TransInfo_get_selected_match (trans_info);
+
+ /* If there is no selection, ignore this transaction. */
+ if (!selected_match) {
+ PWARN("No matching translaction to be cleared was chosen. Imported transaction will be ignored.");
+ break;
+ }
+
/* Transaction gets not imported but the matching one gets
reconciled. */
- if(gnc_import_MatchInfo_get_split
- (gnc_import_TransInfo_get_selected_match (trans_info)) ==NULL)
+ if(gnc_import_MatchInfo_get_split (selected_match) ==NULL)
{
PERR("The split I am trying to reconcile is NULL, shouldn't happen!");
}
@@ -902,15 +910,15 @@
{
/* Reconcile the matching transaction */
/*DEBUG("BeginEdit selected_match")*/
- xaccTransBeginEdit(trans_info->selected_match_info->trans);
+ xaccTransBeginEdit(selected_match->trans);
if (xaccSplitGetReconcile
- (trans_info->selected_match_info->split) == NREC)
+ (selected_match->split) == NREC)
xaccSplitSetReconcile
- (trans_info->selected_match_info->split, CREC);
+ (selected_match->split, CREC);
/* Set reconcile date to today */
xaccSplitSetDateReconciledSecs
- (trans_info->selected_match_info->split,time(NULL));
+ (selected_match->split,time(NULL));
/* Copy the online id to the reconciled transaction, so
the match will be remembered */
@@ -919,13 +927,13 @@
(strlen (gnc_import_get_trans_online_id(trans_info->trans))
> 0))
gnc_import_set_trans_online_id
- (trans_info->selected_match_info->trans,
+ (selected_match->trans,
gnc_import_get_trans_online_id(trans_info->trans));
/* Done editing. */
/*DEBUG("CommitEdit selected_match")*/
xaccTransCommitEdit
- (trans_info->selected_match_info->trans);
+ (selected_match->trans);
/* Store the mapping to the other account in the MatchMap. */
matchmap_store_destination (matchmap, trans_info, TRUE);
@@ -937,6 +945,7 @@
/* Very important: Make sure the freed transaction is not freed again! */
trans_info->trans = NULL;
}
+ }
break;
case GNCImport_EDIT:
PERR("EDIT action is UNSUPPORTED!");
More information about the gnucash-changes
mailing list