[gnumeric] .gnumeric: verify the type derivation of an hlink.



commit 70b7fc3c43b16ca15661c47b087bc01bb2c79754
Author: Morten Welinder <terra gnome org>
Date:   Thu Jun 18 11:11:03 2015 -0400

    .gnumeric: verify the type derivation of an hlink.

 ChangeLog          |    1 +
 src/xml-sax-read.c |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c15f6b0..5390fc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * src/xml-sax-read.c (xml_sax_read_obj): Only allow type names
        specifying types derived from sheet objects.  Fixes #751126.
+       (xml_sax_hlink): Similarly.
 
 2015-06-16  Morten Welinder  <terra gnome org>
 
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 0d8edd8..55f8b38 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -1798,11 +1798,14 @@ xml_sax_hlink (GsfXMLIn *xin, xmlChar const **attrs)
        }
 
        if (NULL != type && NULL != target) {
-               GnmHLink *link = g_object_new (g_type_from_name (type), NULL);
-               gnm_hlink_set_target (link, target);
-               if (tip != NULL)
-                       gnm_hlink_set_tip (link, tip);
-               gnm_style_set_hlink (state->style, link);
+               GType typ = g_type_from_name (type);
+               if (typ != 0 && g_type_is_a (typ, GNM_HLINK_TYPE)) {
+                       GnmHLink *link = g_object_new (typ, NULL);
+                       gnm_hlink_set_target (link, target);
+                       if (tip != NULL)
+                               gnm_hlink_set_tip (link, tip);
+                       gnm_style_set_hlink (state->style, link);
+               }
        }
 
        g_free (type);


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