[gtksourceview/gtksourceview-5-4] snippets: avoid empty strings for snippets
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gtksourceview-5-4] snippets: avoid empty strings for snippets
- Date: Thu, 28 Apr 2022 00:38:45 +0000 (UTC)
commit 924eb28b71e934fca31db6ef834cd583c3d43f06
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 27 11:46:21 2022 -0700
snippets: avoid empty strings for snippets
gtksourceview/gtksourcesnippetbundle.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcesnippetbundle.c b/gtksourceview/gtksourcesnippetbundle.c
index f896b558..478f6e6e 100644
--- a/gtksourceview/gtksourcesnippetbundle.c
+++ b/gtksourceview/gtksourcesnippetbundle.c
@@ -255,9 +255,15 @@ elements_end_element (GMarkupParseContext *context,
for (guint i = 0; state->languages[i]; i++)
{
- info.language = _gtk_source_snippet_manager_intern (state->manager,
state->languages[i]);
+ char *stripped = g_strstrip (g_strdup (state->languages[i]));
- gtk_source_snippet_bundle_add (state->self, &info);
+ if (stripped != NULL && stripped[0] != 0)
+ {
+ info.language = _gtk_source_snippet_manager_intern (state->manager,
stripped);
+ gtk_source_snippet_bundle_add (state->self, &info);
+ }
+
+ g_free (stripped);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]