gnucash stable: Bug 799144 - Date Completion is broken after 5.4 upgrade

John Ralls jralls at code.gnucash.org
Sun Nov 26 12:28:05 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/92de074e (commit)
	from  https://github.com/Gnucash/gnucash/commit/c07e0890 (commit)



commit 92de074e496b3e37493689e5aa06c3e094cfe22a
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 26 09:23:58 2023 -0800

    Bug 799144 - Date Completion is broken after 5.4 upgrade
    
    strptime will reasonable return false for an incomplete date but it
    still fills in the parts of the struct tm that it understands, so bail
    out of qof_scan_date_internal when it fails only if all three fields
    are present.

diff --git a/libgnucash/engine/gnc-date.cpp b/libgnucash/engine/gnc-date.cpp
index 80b309edfb..8c202e40e4 100644
--- a/libgnucash/engine/gnc-date.cpp
+++ b/libgnucash/engine/gnc-date.cpp
@@ -756,11 +756,11 @@ qof_scan_date_internal (const char *buff, int *day, int *month, int *year,
             char *strv = strptime (buff, normalize_format(GNC_D_FMT).c_str(),
                                    &thetime);
 
-            if (!strv) // Parse failed, continuing gives the wrong result.
-                return FALSE;
-
             if (third_field)
             {
+                if (!strv) // Parse failed, continuing gives the wrong result.
+                    return FALSE;
+
                 /* Easy.  All three values were parsed. */
                 iyear = thetime.tm_year + 1900;
                 iday = thetime.tm_mday;



Summary of changes:
 libgnucash/engine/gnc-date.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list