[recipes] Be more careful about handling NULL strings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Be more careful about handling NULL strings
- Date: Wed, 22 Feb 2017 14:32:53 +0000 (UTC)
commit a147341ad26555eadd630475943851c7fa4c36ca
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Feb 22 09:29:42 2017 -0500
Be more careful about handling NULL strings
Same for the GrChef object, just to be consistent.
src/gr-chef.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/gr-chef.c b/src/gr-chef.c
index 0016b7a..8c2891b 100644
--- a/src/gr-chef.c
+++ b/src/gr-chef.c
@@ -135,10 +135,11 @@ gr_chef_set_property (GObject *object,
break;
case PROP_DESCRIPTION:
- g_free (self->description);
+ g_clear_pointer (&self->description, g_free);
+ g_clear_pointer (&self->translated_description, g_free);
self->description = g_value_dup_string (value);
- g_free (self->translated_description);
- self->translated_description = translate_multiline_string (self->description);
+ if (self->description)
+ self->translated_description = translate_multiline_string (self->description);
break;
case PROP_IMAGE_PATH:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]