Bug 685329 - Crashes on non-existent date

Log an error instead of crashing. The transaction will be imported with
today’s date.
This commit is contained in:
John Ralls 2016-12-11 16:32:15 -08:00
parent 78b41f7ac1
commit 54beffd936

View File

@ -1973,9 +1973,15 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year)
GDate *date;
if (!trans) return;
date = g_date_new_dmy(day, mon, year);
g_assert(g_date_valid(date));
if (!g_date_valid(date))
{
PWARN("Attempted to set invalid date %d-%d-%d; set today's date instead.",
year, mon, day);
g_free(date);
date = gnc_g_date_new_today();
}
xaccTransSetDatePostedGDate(trans, *date);
g_date_free(date);
g_free(date);
}
void