Skip to content

Commit

Permalink
Fix segfault after behaviour change of qof_book_get_autoreadonly_gdat…
Browse files Browse the repository at this point in the history
…e() in r22118.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22122 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
cstim committed Mar 25, 2012
1 parent 663c9f9 commit b208b06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/engine/Transaction.c
Expand Up @@ -1971,6 +1971,7 @@ gboolean xaccTransIsReadonlyByPostedDate(const Transaction *trans)
}

threshold_date = qof_book_get_autoreadonly_gdate(book);
g_assert(threshold_date); // ok because we checked uses_autoreadonly before
trans_date = xaccTransGetDatePostedGDate(trans);

// g_warning("there is auto-read-only with days=%d, trans_date_day=%d, threshold_date_day=%d",
Expand Down
6 changes: 4 additions & 2 deletions src/register/ledger-core/split-register-load.c
Expand Up @@ -277,7 +277,7 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
int new_trans_split_row = -1;
int new_trans_row = -1;
int new_split_row = -1;
time_t present, autoreadonly_time;
time_t present, autoreadonly_time = 0;

g_return_if_fail(reg);
table = reg->table;
Expand Down Expand Up @@ -434,9 +434,11 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,

/* get the current time and reset the dividing row */
present = gnc_timet_get_today_end ();
if (use_autoreadonly)
{
GDate *d = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
autoreadonly_time = timespecToTime_t(gdate_to_timespec(*d));
// "d" is NULL if use_autoreadonly is FALSE
autoreadonly_time = d ? timespecToTime_t(gdate_to_timespec(*d)) : 0;
g_date_free(d);
}

Expand Down

0 comments on commit b208b06

Please sign in to comment.