From: John Darrington Date: Mon, 9 Jul 2007 11:31:17 +0000 (+0000) Subject: Prevent crash when attempting to insert cases when dictionary is empty. X-Git-Tag: v0.6.0~399 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02c766f3f1ff964f0d4fa4849f1a55e193afa48d;p=pspp-builds.git Prevent crash when attempting to insert cases when dictionary is empty. --- diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 61fee9bc..c223ccf2 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -466,10 +466,10 @@ psppire_data_store_insert_new_case (PsppireDataStore *ds, casenumber posn) struct ccase cc; g_return_val_if_fail (ds, FALSE); - - /* Opportunity for optimisation exists here when creating a blank case */ val_cnt = datasheet_get_column_cnt (ds->case_file->datasheet) ; + g_return_val_if_fail (val_cnt > 0, FALSE); + case_create (&cc, val_cnt); memset ( case_data_rw_idx (&cc, 0), 0, val_cnt * MAX_SHORT_STRING);