mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user