[gtranslator] Early return if there's no lang



commit 325cbcd500c91f226c791a20511242ed74ce9ac0
Author: Daniel GarcĂ­a Moreno <danigm wadobo com>
Date:   Sun Jan 6 11:30:23 2019 +0100

    Early return if there's no lang
    
    This allow us to open po files without headers
    
    See #45

 src/gtr-view.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/gtr-view.c b/src/gtr-view.c
index f18e4739..be658d5a 100644
--- a/src/gtr-view.c
+++ b/src/gtr-view.c
@@ -235,7 +235,12 @@ gtr_view_set_language (GtrView *view,
   GList *langs = (GList *)gspell_language_get_available ();
   gchar **lang_parts = NULL;
   gboolean found = FALSE;
-  gchar *def_lang = get_default_lang (lang);
+  gchar *def_lang;
+
+  if (!lang || *lang == '\0')
+    return;
+
+  def_lang = get_default_lang (lang);
 
   while (langs)
     {


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