[gspell] language: do not allow NULL language for get_name()



commit 5a6afa7e2f12535d65375e7f5ff20604e4e55527
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Dec 27 19:00:08 2015 +0100

    language: do not allow NULL language for get_name()
    
    This doesn't really makes sense at the GspellLanguage level. If there is
    no languages available, a string like "No dictionaries available" can be
    displayed in a certain widget, like a language chooser. But as far as
    GspellLanguage is concerned, to return a name the language must exist.

 gspell/gspell-language.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/gspell/gspell-language.c b/gspell/gspell-language.c
index 8ddaffa..dbaef55 100644
--- a/gspell/gspell-language.c
+++ b/gspell/gspell-language.c
@@ -435,13 +435,7 @@ gspell_language_get_code (const GspellLanguage *language)
 const gchar *
 gspell_language_get_name (const GspellLanguage *language)
 {
-       if (language == NULL)
-       {
-               /* Translators: This refers to the default language used by the
-                * spell checker.
-                */
-               return C_("language", "Default");
-       }
+       g_return_val_if_fail (language != NULL, NULL);
 
        return language->name;
 }


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