diff --git a/lightningd/io_loop_with_timers.c b/lightningd/io_loop_with_timers.c index e1e9d7002..f2b0165a5 100644 --- a/lightningd/io_loop_with_timers.c +++ b/lightningd/io_loop_with_timers.c @@ -26,9 +26,12 @@ void *io_loop_with_timers(struct lightningd *ld) /*~ Notice that timers are called here in the event loop like * anything else, so there are no weird concurrency issues. */ if (expired) { - db_begin_transaction(ld->wallet->db); + /* This routine is legal in early startup, too. */ + if (ld->wallet) + db_begin_transaction(ld->wallet->db); timer_expired(ld, expired); - db_commit_transaction(ld->wallet->db); + if (ld->wallet) + db_commit_transaction(ld->wallet->db); } }