[gnome-builder/gnome-builder-3-30] langserv: fix warning when querying for "items" inside non-vardict



commit 52da3cc107c9db94219e60c92b87727127403df2
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 25 11:33:24 2018 -0700

    langserv: fix warning when querying for "items" inside non-vardict

 src/libide/langserv/ide-langserv-completion-results.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/langserv/ide-langserv-completion-results.c 
b/src/libide/langserv/ide-langserv-completion-results.c
index 61deb0633..a1194ebe9 100644
--- a/src/libide/langserv/ide-langserv-completion-results.c
+++ b/src/libide/langserv/ide-langserv-completion-results.c
@@ -80,7 +80,9 @@ ide_langserv_completion_results_new (GVariant *results)
   self = g_object_new (IDE_TYPE_LANGSERV_COMPLETION_RESULTS, NULL);
   self->results = g_variant_ref_sink (results);
 
-  if ((items = g_variant_lookup_value (results, "items", NULL)))
+  /* Possibly unwrap the {items: []} style result. */
+  if (g_variant_is_of_type (results, G_VARIANT_TYPE_VARDICT) &&
+      (items = g_variant_lookup_value (results, "items", NULL)))
     {
       g_clear_pointer (&self->results, g_variant_unref);
 


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