[gnome-builder] ctags: fix potential NULL word with new text-iter design
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] ctags: fix potential NULL word with new text-iter design
- Date: Thu, 3 May 2018 05:29:47 +0000 (UTC)
commit 683252496c1756bc1397d25a8319d439453b0bc9
Author: Christian Hergert <chergert redhat com>
Date: Wed May 2 22:30:21 2018 -0700
ctags: fix potential NULL word with new text-iter design
Now that _ide_text_iter_current_symbol() is used (which can return NULL)
we need to be more careful here.
src/plugins/ctags/ide-ctags-completion-provider.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/ctags/ide-ctags-completion-provider.c
b/src/plugins/ctags/ide-ctags-completion-provider.c
index 6e081b781..ca6027568 100644
--- a/src/plugins/ctags/ide-ctags-completion-provider.c
+++ b/src/plugins/ctags/ide-ctags-completion-provider.c
@@ -201,6 +201,13 @@ ide_ctags_completion_provider_populate (GtkSourceCompletionProvider *provider,
g_clear_pointer (&self->current_word, g_free);
self->current_word = ide_completion_provider_context_current_word (context);
+ if (self->current_word == NULL)
+ IDE_GOTO (word_too_small);
+
+ word_len = strlen (self->current_word);
+ if (word_len < self->minimum_word_size)
+ IDE_GOTO (word_too_small);
+
allowed = get_allowed_suffixes (context);
if (self->results != NULL)
@@ -213,10 +220,6 @@ ide_ctags_completion_provider_populate (GtkSourceCompletionProvider *provider,
g_clear_pointer (&self->results, g_object_unref);
}
- word_len = strlen (self->current_word);
- if (word_len < self->minimum_word_size)
- IDE_GOTO (word_too_small);
-
casefold = g_utf8_casefold (self->current_word, -1);
self->results = ide_completion_results_new (self->current_word);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]