gnumeric r16381 - in branches/gnumeric-1-8: . plugins/mps



Author: mortenw
Date: Mon Feb 18 15:24:04 2008
New Revision: 16381
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16381&view=rev

Log:
2008-02-18  Morten Welinder  <terra gnome org>

	* mps.c (mps_input_context_new): Initialize ->objective_row.
	* parser.c (mps_parse_rows): Handle missing objective row.  Fixes
	#517141.



Modified:
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/plugins/mps/ChangeLog
   branches/gnumeric-1-8/plugins/mps/mps.c
   branches/gnumeric-1-8/plugins/mps/parser.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Mon Feb 18 15:24:04 2008
@@ -20,7 +20,8 @@
 	* Fix circular array formula problem.
 	* Work around Qt theme bug.  [#512752]
 	* Fix paste-as-text bug.  [#514438]
-	* Fix corrupted-qpro-bugs.  [#517144]
+	* Fix corrupted-mps-bug.  [#517141]
+	* Fix corrupted-qpro-bug.  [#517144]
 
 --------------------------------------------------------------------------
 Gnumeric 1.8.1

Modified: branches/gnumeric-1-8/plugins/mps/mps.c
==============================================================================
--- branches/gnumeric-1-8/plugins/mps/mps.c	(original)
+++ branches/gnumeric-1-8/plugins/mps/mps.c	Mon Feb 18 15:24:04 2008
@@ -525,6 +525,7 @@
         ctxt->row_hash	     = g_hash_table_new (g_str_hash, g_str_equal);
         ctxt->col_hash	     = g_hash_table_new (g_str_hash, g_str_equal);
         ctxt->col_name_tbl   = NULL;
+	ctxt->objective_row  = NULL;
         ctxt->matrix	     = NULL;
 
 	ctxt->n_rows = ctxt->n_cols = ctxt->n_bounds = 0;

Modified: branches/gnumeric-1-8/plugins/mps/parser.c
==============================================================================
--- branches/gnumeric-1-8/plugins/mps/parser.c	(original)
+++ branches/gnumeric-1-8/plugins/mps/parser.c	Mon Feb 18 15:24:04 2008
@@ -302,9 +302,13 @@
 	        MpsRow *row = (MpsRow *) tmp->data;
 		g_hash_table_insert (ctxt->row_hash, row->name, (gpointer) row);
 	}
-	g_hash_table_insert (ctxt->row_hash, ctxt->objective_row->name,
-			     (gpointer) ctxt->objective_row);
-	ctxt->objective_row->index = ctxt->n_rows;
+	if (ctxt->objective_row) {
+		g_hash_table_insert (ctxt->row_hash, ctxt->objective_row->name,
+				     (gpointer) ctxt->objective_row);
+		ctxt->objective_row->index = ctxt->n_rows;
+	} else {
+		g_warning ("Missing objective row.  File is most likely corrupted.");
+	}
 	ctxt->n_rows += 1;
 
 	return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]