[goffice] GOPixbuf: avoid critical.



commit de3845253c6d85b0900e4a3dc2a1a143daeb70df
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 20 13:09:09 2012 -0400

    GOPixbuf: avoid critical.

 ChangeLog                 |    5 +++++
 NEWS                      |    1 +
 goffice/utils/go-pixbuf.c |    6 ++++--
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4bd3b2c..ea93a2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-20  Morten Welinder  <terra gnome org>
+
+	* goffice/utils/go-pixbuf.c (go_pixbuf_save): Survive lack of
+	image data.
+
 2012-03-18 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* goffice/utils/go-format.c (go_format_output_number_to_odf): do not
diff --git a/NEWS b/NEWS
index 1332e2e..f7508bb 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Morten:
 	* Tweak bold attribute for rich text.
 	* Fix minor multihead issue with help buttons in dialogs.
 	* Eliminate GoComboText -- use GtkComboBoxText instead.
+	* Avoid critical in GOPixbuf code.
 
 --------------------------------------------------------------------------
 goffice 0.9.2:
diff --git a/goffice/utils/go-pixbuf.c b/goffice/utils/go-pixbuf.c
index b1f28af..7ba1d36 100644
--- a/goffice/utils/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -293,8 +293,10 @@ go_pixbuf_save (GOImage *image, GsfXMLOut *output)
 	g_return_if_fail (GO_IS_PIXBUF (image));
 	pixbuf = GO_PIXBUF (image);
 	gsf_xml_out_add_int (output, "rowstride", pixbuf->rowstride);
-	gsf_xml_out_add_base64 (output, NULL,
-			image->data, image->height * pixbuf->rowstride);
+	if (image->data)
+		gsf_xml_out_add_base64
+			(output, NULL,
+			 image->data, image->height * pixbuf->rowstride);
 }
 
 static void



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