[gnumeric] Fixed crash when saving an image whose type is unkown.



commit 6049cc6411955ab375874a1ed2ed2bbc7c249469
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Oct 31 17:24:58 2011 +0100

    Fixed crash when saving an image whose type is unkown.

 ChangeLog                |    5 +++++
 src/sheet-object-image.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5027712..01b4494 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-31  Jean Brefort  <jean brefort normalesup org>
+
+	* src/sheet-object-image.c (gnm_soi_write_image), (soi_cb_save_as): don't
+	crash when the image type is unknown.
+
 2011-10-29  Jean Brefort  <jean brefort normalesup org>
 
 	* component/gnumeric.c (go_gnm_component_init): fixed build.
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index ac5d067..5bf9650 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -409,7 +409,7 @@ gnm_soi_write_image (SheetObject const *so, char const *format, double resolutio
 	gboolean res = FALSE;
 	GdkPixbuf *pixbuf = soi_get_pixbuf (soi, 1.0);
 
-	if (strcmp (format, soi->type) == 0)
+	if (!soi->type || strcmp (format, soi->type) == 0)
 		res = gsf_output_write (output,
 					soi->bytes.len, soi->bytes.data);
 	else if (pixbuf)
@@ -458,7 +458,7 @@ soi_cb_save_as (SheetObject *so, SheetControl *sc)
 	if (!output)
 		goto out;
 	format_info = go_image_get_format_info (sel_fmt);
-	sheet_object_write_image (so, format_info->name, -1.0, output, &err);
+	sheet_object_write_image (so, (format_info? format_info->name: NULL), -1.0, output, &err);
 	gsf_output_close (output);
 	g_object_unref (output);
 



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