gnumeric r16444 - in branches/gnumeric-1-8: . plugins/applix



Author: mortenw
Date: Fri Mar  7 00:06:33 2008
New Revision: 16444
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16444&view=rev

Log:
2008-03-06  Morten Welinder  <terra gnome org>

	* applix-read.c (applix_read): Fix null deref.  #520873.



Modified:
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/plugins/applix/ChangeLog
   branches/gnumeric-1-8/plugins/applix/applix-read.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Fri Mar  7 00:06:33 2008
@@ -25,7 +25,7 @@
 	* Fix corrupted-sylk-bug.
 	* Make <control>KP_Subtract work as <control>minus.  [#516358]
 	* Make <control>KP_Add work as <control>plus.
-	* Fix corrupted-applix-bugs.  [#517778]
+	* Fix corrupted-applix-bugs.  [#517778] [#520873]
 	* Fix sylk importer's format handling.
 	* Fix memory allocation failure for huge .gnumeric files.  [#519319]
 	* Fix mstyle problem.  [#519451]

Modified: branches/gnumeric-1-8/plugins/applix/applix-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/applix/applix-read.c	(original)
+++ branches/gnumeric-1-8/plugins/applix/applix-read.c	Fri Mar  7 00:06:33 2008
@@ -1664,10 +1664,13 @@
 	g_slist_free (state.sheet_order);
 
 	renamed_sheets = NULL;
-	for (ptr = state.std_names; ptr != NULL ; ptr = ptr->next)
+	for (ptr = state.std_names; ptr != NULL ; ptr = ptr->next) {
+		const char *name = ptr->data;
+		Sheet *sheet = workbook_sheet_by_name (state.wb, name);
+		int idx = sheet ? sheet->index_in_wb : -1;
 		renamed_sheets = g_slist_prepend (renamed_sheets,
-			GINT_TO_POINTER (workbook_sheet_by_name
-					 (state.wb, ptr->data)->index_in_wb));
+						  GINT_TO_POINTER (idx));
+	}
 	renamed_sheets = g_slist_reverse (renamed_sheets);
 	workbook_sheet_rename (state.wb, renamed_sheets,
 			       state.real_names,



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