Prevent crash when attempting to insert cases when dictionary is empty.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 9 Jul 2007 11:31:17 +0000 (11:31 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 9 Jul 2007 11:31:17 +0000 (11:31 +0000)
src/ui/gui/psppire-data-store.c

index 61fee9bc35c99ef032410c0c60e9d5e1b91a5945..c223ccf2a469684854cc87d87594110acd5fc6eb 100644 (file)
@@ -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);