[gnome-builder/wip/gtk4-port] plugins/copyright: do less work
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/copyright: do less work
- Date: Fri, 20 May 2022 00:49:23 +0000 (UTC)
commit 2b6a57336b1be7c1aafa31b7b2235a25470196e6
Author: Christian Hergert <chergert redhat com>
Date: Thu May 19 17:49:06 2022 -0700
plugins/copyright: do less work
src/plugins/copyright/gbp-copyright-util.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/copyright/gbp-copyright-util.c b/src/plugins/copyright/gbp-copyright-util.c
index f3a9e1335..0012fb1be 100644
--- a/src/plugins/copyright/gbp-copyright-util.c
+++ b/src/plugins/copyright/gbp-copyright-util.c
@@ -102,9 +102,14 @@ gbp_update_copyright (const char *input,
regex = g_regex_new ("([0-9]{4})", G_REGEX_OPTIMIZE, 0, NULL);
tokens = g_regex_split (regex, input, 0);
- n_tokens = g_strv_length (tokens);
- if (n_tokens < 2 || n_tokens > 6)
+ /* n_tokens > 2 */
+ if (tokens == NULL || tokens[0] == NULL || tokens[1] == NULL)
+ return NULL;
+
+ /* Sanity check */
+ n_tokens = g_strv_length (tokens);
+ if (n_tokens > 6)
return NULL;
return replace_copyright_year ((const char * const *)tokens, n_tokens, with_year);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]