gnumeric r16380 - in trunk: . plugins/mps



Author: mortenw
Date: Mon Feb 18 15:23:25 2008
New Revision: 16380
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16380&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:
   trunk/NEWS
   trunk/plugins/mps/ChangeLog
   trunk/plugins/mps/mps.c
   trunk/plugins/mps/parser.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Feb 18 15:23:25 2008
@@ -31,7 +31,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.0

Modified: trunk/plugins/mps/mps.c
==============================================================================
--- trunk/plugins/mps/mps.c	(original)
+++ trunk/plugins/mps/mps.c	Mon Feb 18 15:23:25 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: trunk/plugins/mps/parser.c
==============================================================================
--- trunk/plugins/mps/parser.c	(original)
+++ trunk/plugins/mps/parser.c	Mon Feb 18 15:23:25 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]