[gnome-builder] clang: protect against unlikely but possible reply
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] clang: protect against unlikely but possible reply
- Date: Tue, 5 Mar 2019 20:34:18 +0000 (UTC)
commit fdac24b5e3526477c6fd0c0964b2b75d5cc1dc08
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 5 11:57:42 2019 -0800
clang: protect against unlikely but possible reply
src/plugins/clang/ide-clang-completion-item.c | 1 -
src/plugins/clang/ide-clang-proposals.c | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/clang/ide-clang-completion-item.c b/src/plugins/clang/ide-clang-completion-item.c
index 93ca4d391..d4eebbae9 100644
--- a/src/plugins/clang/ide-clang-completion-item.c
+++ b/src/plugins/clang/ide-clang-completion-item.c
@@ -471,7 +471,6 @@ ide_clang_completion_item_new (GVariant *variant,
g_assert (variant != NULL);
g_assert (keyword != NULL);
- g_assert (keyword[0] != 0);
ret = g_object_new (IDE_TYPE_CLANG_COMPLETION_ITEM, NULL);
ret->results = g_variant_ref (variant);
diff --git a/src/plugins/clang/ide-clang-proposals.c b/src/plugins/clang/ide-clang-proposals.c
index bfe5375e6..e28c2204e 100644
--- a/src/plugins/clang/ide-clang-proposals.c
+++ b/src/plugins/clang/ide-clang-proposals.c
@@ -767,7 +767,9 @@ ide_clang_proposals_get_item (GListModel *model,
g_autoptr(GVariant) child = g_variant_get_child_value (self->results, item->index);
const gchar *keyword = NULL;
- g_variant_lookup (child, "keyword", "&s", &keyword);
+ /* Very unlikely, but I've seen it once from libclang, so protect against it */
+ if (!g_variant_lookup (child, "keyword", "&s", &keyword))
+ keyword = "";
return ide_clang_completion_item_new (self->results, item->index, keyword);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]