Bug 743807 Stops critical error messages.

As you type a date into the calendar widget it tries to make a GDate
with the current year and month, if you are typing 31/ in February
you get a critical error in the trace file. This patch adds a test
for a valid date before proceeding.
This commit is contained in:
Robert Fewell 2015-02-03 13:53:15 +00:00 committed by Geert Janssens
parent 068fc3567d
commit 7bddcd95b0

View File

@ -254,6 +254,10 @@ gnc_handle_date_accelerator (GdkEventKey *event,
if ((tm->tm_mday <= 0) || (tm->tm_mon == -1) || (tm->tm_year == -1))
return FALSE;
// Make sure we have a valid date before we proceed
if (!g_date_valid_dmy (tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900))
return FALSE;
g_date_set_dmy (&gdate,
tm->tm_mday,
tm->tm_mon + 1,