[gtk/wip/chergert/spellcheck: 33/40] spellcheck: check for valid language




commit f25e53bd458d5ceab6ce33fb472a607c0d8eacdc
Author: Christian Hergert <chergert redhat com>
Date:   Mon Mar 15 15:25:22 2021 -0700

    spellcheck: check for valid language

 gtk/gtkspellcheck.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkspellcheck.c b/gtk/gtkspellcheck.c
index 7578889008..eae0275f15 100644
--- a/gtk/gtkspellcheck.c
+++ b/gtk/gtkspellcheck.c
@@ -160,7 +160,12 @@ gtk_spell_checker_set_languages (GtkSpellChecker    *self,
 
           if (gtk_spell_provider_supports (provider, code))
             {
-              g_ptr_array_add (self->languages, _gtk_spell_language_new (provider, code));
+              GtkSpellLanguage *language = _gtk_spell_language_new (provider, code);
+
+              if (language == NULL)
+                continue;
+
+              g_ptr_array_add (self->languages, language);
               break;
             }
         }


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