gnucash stable: Bug 799121 - Parse error on CSV import on MacOS
John Ralls
jralls at code.gnucash.org
Thu Nov 16 23:30:38 EST 2023
Updated via https://github.com/Gnucash/gnucash/commit/102304b3 (commit)
from https://github.com/Gnucash/gnucash/commit/8d993e73 (commit)
commit 102304b38b153a5b87280da88d0679663eec2e1f
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Nov 16 18:15:17 2023 -0800
Bug 799121 - Parse error on CSV import on MacOS
Use csv_tximp_preview_sep_button_cb solely as a callback, its error
handling doesn't make sense otherwise. All we want at the end of
preview_refresh is to attempt a tokenize.
In addition to not going into an infinite loop with the message box
this presents a more helpful message suggesting that the encoding is
wrong.
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index 55823b93b1..d1cb2480ea 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -34,6 +34,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <stdexcept>
#include <stdlib.h>
#include "gnc-path.h"
@@ -1726,7 +1727,14 @@ CsvImpTransAssist::preview_refresh ()
gtk_entry_set_text (GTK_ENTRY(custom_entry), separators.c_str());
g_signal_handlers_unblock_by_func (custom_cbutton, (gpointer) csv_tximp_preview_sep_button_cb, this);
g_signal_handlers_unblock_by_func (custom_entry, (gpointer) csv_tximp_preview_sep_button_cb, this);
- csv_tximp_preview_sep_button_cb (GTK_WIDGET (custom_cbutton), this);
+ try
+ {
+ tx_imp->tokenize (false);
+ }
+ catch(std::range_error& err)
+ {
+ PERR("CSV Tokenization Failed: %s", err.what());
+ }
}
// Repopulate the parsed data table
Summary of changes:
gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list