From f084fc67f7433a47873ca24db69e29e2e6371d13 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 30 Mar 2018 16:58:19 -0700 Subject: [PATCH] Catch guid_syntax_exception in build_bayes. --- libgnucash/engine/Account.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index 6f63fcb9ba..550bec7dcd 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -5584,8 +5584,16 @@ static void build_bayes (const char *key, KvpValue * value, GncImapInfo & imapInfo) { auto parsed_key = parse_bayes_imap_info (key); - auto temp_guid = gnc::GUID::from_string (std::get <2> (parsed_key)); - GncGUID guid = temp_guid; + GncGUID guid; + try + { + auto temp_guid = gnc::GUID::from_string (std::get <2> (parsed_key)); + guid = temp_guid; + } + catch (const gnc::guid_syntax_exception& err) + { + PWARN("Invalid GUID string from %s", key); + } auto map_account = xaccAccountLookup (&guid, gnc_account_get_book (imapInfo.source_account)); auto imap_node = static_cast (g_malloc (sizeof (GncImapInfo))); auto count = value->get ();