[gnome-builder/wip/chergert/lsp-plugin-loader: 13/24] libide/lsp: check for empty strings




commit 5ee85a4edc3658c752c72dcb974fc69ceeac7f14
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 14 10:39:31 2022 -0500

    libide/lsp: check for empty strings
    
    This just makes it easier to handle possible empty strings from splitting
    by ';' in the .plugin file.

 src/libide/lsp/ide-lsp-plugin.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/lsp/ide-lsp-plugin.c b/src/libide/lsp/ide-lsp-plugin.c
index 1d6bedc40..158c30079 100644
--- a/src/libide/lsp/ide-lsp-plugin.c
+++ b/src/libide/lsp/ide-lsp-plugin.c
@@ -120,7 +120,12 @@ ide_lsp_plugin_service_configure_client (IdeLspService *service,
   if (klass->info->languages != NULL)
     {
       for (guint i = 0; klass->info->languages[i]; i++)
-        ide_lsp_client_add_language (client, klass->info->languages[i]);
+        {
+          const char *language = klass->info->languages[i];
+
+          if (!ide_str_empty0 (language))
+            ide_lsp_client_add_language (client, language);
+        }
     }
 
   if (!(context = ide_object_get_context (IDE_OBJECT (service))))


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