[clutter] text: Consistently protect against NULL strings
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] text: Consistently protect against NULL strings
- Date: Wed, 7 Sep 2011 14:37:36 +0000 (UTC)
commit 320bdeac03a97dafb8929c93df795e1b2e5bc694
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Sep 7 13:08:22 2011 +0100
text: Consistently protect against NULL strings
When calling clutter_text_set_text_internal() or
clutter_text_set_markup_internal() we need to make sure to pass a
non-NULL string.
clutter/clutter-text.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index 5423b77..afa6a18 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -1186,10 +1186,11 @@ clutter_text_set_property (GObject *gobject,
const char *str = g_value_get_string (value);
clutter_text_set_contents (self, str);
+
if (self->priv->use_markup)
- clutter_text_set_markup_internal (self, str);
+ clutter_text_set_markup_internal (self, str ? str : "");
else
- clutter_text_set_text_internal (self, str);
+ clutter_text_set_text_internal (self, str ? str : "");
}
break;
@@ -4508,6 +4509,7 @@ clutter_text_set_text (ClutterText *self,
* Pango markup, and it is logically equivalent to:
*
* |[
+ * /* the order is important */
* clutter_text_set_text (CLUTTER_TEXT (actor), markup);
* clutter_text_set_use_markup (CLUTTER_TEXT (actor), TRUE);
* ]|
@@ -4522,11 +4524,7 @@ clutter_text_set_markup (ClutterText *self,
clutter_text_set_use_markup_internal (self, TRUE);
clutter_text_set_contents (self, markup);
-
- if (markup != NULL && *markup != '\0')
- clutter_text_set_markup_internal (self, markup);
- else
- clutter_text_set_text_internal (self, "");
+ clutter_text_set_markup_internal (self, markup ? markup : "");
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]