From: John Darrington Date: Wed, 21 Jun 2023 10:02:06 +0000 (+0200) Subject: Fixed a crash when trying to insert variables into the datasheet X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb0c699e82b6b868f0ae46ea3a48aa00f7563e7f;p=pspp Fixed a crash when trying to insert variables into the datasheet --- diff --git a/src/data/datasheet.c b/src/data/datasheet.c index 816b7150e2..0e523a20d7 100644 --- a/src/data/datasheet.c +++ b/src/data/datasheet.c @@ -418,11 +418,12 @@ datasheet_move_columns (struct datasheet *ds, size_t old_start, size_t new_start, size_t n) { - assert (old_start + n <= ds->n_columns); assert (new_start + n <= ds->n_columns); - - move_range (ds->columns, ds->n_columns, sizeof *ds->columns, - old_start, new_start, n); + if (old_start + n <= ds->n_columns) + { + move_range (ds->columns, ds->n_columns, sizeof *ds->columns, + old_start, new_start, n); + } caseproto_unref (ds->proto); ds->proto = NULL;