From d629f894c41fdc9c3338c282332bc3d0151ed4e6 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Wed, 22 Aug 2012 15:16:33 -0400 Subject: Bug 682494 - Add some defensive checks in gal-a11y-e-text.c --- widgets/text/gal-a11y-e-text.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c index 5632665bc3..6f62ae74c6 100644 --- a/widgets/text/gal-a11y-e-text.c +++ b/widgets/text/gal-a11y-e-text.c @@ -93,11 +93,16 @@ et_get_extents (AtkComponent *component, static const gchar * et_get_full_text (AtkText *text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object ( - ATK_GOBJECT_ACCESSIBLE (text))); + GObject *obj; + EText *etext; ETextModel *model; const gchar *full_text; + obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + if (obj == NULL) + return ""; + + etext = E_TEXT (obj); g_object_get (etext, "model", &model, NULL); full_text = e_text_model_get_text (model); @@ -109,10 +114,15 @@ static void et_set_full_text (AtkEditableText *text, const gchar *full_text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object ( - ATK_GOBJECT_ACCESSIBLE (text))); + GObject *obj; + EText *etext; ETextModel *model; + obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + if (obj == NULL) + return; + + etext = E_TEXT (obj); g_object_get (etext, "model", &model, NULL); e_text_model_set_text (model, full_text); @@ -648,8 +658,13 @@ et_get_offset_at_point (AtkText *text, static gint et_get_n_selections (AtkText *text) { - EText *etext = E_TEXT (atk_gobject_accessible_get_object ( - ATK_GOBJECT_ACCESSIBLE (text))); + EText *etext; + GObject *obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); + + if (obj == NULL) + return -1; + etext = E_TEXT (obj); + if (etext->selection_start != etext->selection_end) return 1; -- cgit v1.2.3