[gtksourceview/wip/chergert/gsv-gtk4] completion: handle error cases better
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4] completion: handle error cases better
- Date: Thu, 10 Sep 2020 03:53:30 +0000 (UTC)
commit 28dbec3ec3468ac971d7ccddf11d05399826f46e
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 9 20:50:19 2020 -0700
completion: handle error cases better
gtksourceview/gtksourcecompletioncontext.c | 3 +++
gtksourceview/gtksourcecompletionprovider.c | 12 +++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourcecompletioncontext.c b/gtksourceview/gtksourcecompletioncontext.c
index 22e8d4bc..9a84d6c9 100644
--- a/gtksourceview/gtksourcecompletioncontext.c
+++ b/gtksourceview/gtksourcecompletioncontext.c
@@ -363,6 +363,9 @@ _gtk_source_completion_context_get_item_full (GtkSourceCompletionContext *self
n_items = g_list_model_get_n_items (info->results);
+ if (n_items == 0)
+ continue;
+
if (position >= n_items)
{
position -= n_items;
diff --git a/gtksourceview/gtksourcecompletionprovider.c b/gtksourceview/gtksourcecompletionprovider.c
index 526e49cf..35a5cd6e 100644
--- a/gtksourceview/gtksourcecompletionprovider.c
+++ b/gtksourceview/gtksourcecompletionprovider.c
@@ -48,7 +48,17 @@ fallback_populate_async (GtkSourceCompletionProvider *provider,
if (ret == NULL)
{
- g_task_return_error (task, g_steal_pointer (&error));
+ if (error != NULL)
+ {
+ g_task_return_error (task, g_steal_pointer (&error));
+ }
+ else
+ {
+ g_task_return_new_error (task,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ "No results");
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]