From 2a4071f8dcad478b7e8150a31bdff999d112c171 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Sat, 27 Jul 2019 23:54:16 -0400 Subject: [PATCH] Prevent some near-startup coredumps. Fixes #38. --- src/common/main.c | 2 +- src/common/sheet.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/main.c b/src/common/main.c index b9db34e..0c96e00 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -330,7 +330,7 @@ static void do_attribute(Sheet *cursheet, Key action) adj = LEFT; do_mark(cursheet, GET_MARK_CUR); onecell = SAME_LOC(cursheet->mark1, cursheet->mark2); - fcell = CELL_AT(cursheet, cursheet->mark1); + fcell = safe_cell_at(cursheet, cursheet->mark1); if (action != ADJUST_LOCK && onecell && locked(fcell)) { line_msg(_("Cell attribute:"),_("Cell is locked")); diff --git a/src/common/sheet.c b/src/common/sheet.c index cbe3d14..f3f5dd8 100644 --- a/src/common/sheet.c +++ b/src/common/sheet.c @@ -446,6 +446,7 @@ void forceupdate(Sheet *sheet) Cell *cell; assert(sheet!=(Sheet*)0); + if (sheet->sheet == (Cell **)0) return; for (ALL_CELLS_IN_SHEET(sheet,i,cell)) if (cell != NULLCELL) cell->updated = cell->clock_t0 = cell->clock_t1 = cell->clock_t2 = 0;