[recipes] Make a translate_multiline_string NULL-safe



commit 3d12823b8c4483c1531675d6739d9959a560f759
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 19 20:53:16 2017 -0500

    Make a translate_multiline_string NULL-safe
    
    This happens right away when translating notes.

 src/gr-utils.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-utils.c b/src/gr-utils.c
index 83ecc19..0b6e0f5 100644
--- a/src/gr-utils.c
+++ b/src/gr-utils.c
@@ -342,6 +342,9 @@ translate_multiline_string (const char *s)
         int i;
         GString *out;
 
+        if (s == NULL)
+                return NULL;
+
         out = g_string_new ("");
 
         strv = g_strsplit (s, "\n", -1);
@@ -351,7 +354,7 @@ translate_multiline_string (const char *s)
                         g_string_append (out, "\n");
                 if (strv[i][0] != 0)
                         g_string_append (out, _(strv[i]));
-        }
+       }
 
         return g_string_free (out, FALSE);
 }


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