[gegl] bin: do not crash with no key/value pairs in op
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] bin: do not crash with no key/value pairs in op
- Date: Thu, 6 Jun 2019 10:28:04 +0000 (UTC)
commit 60036dcddc8710b692d1569fae510b477087d96a
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jun 6 12:27:26 2019 +0200
bin: do not crash with no key/value pairs in op
Fixing issue #168
bin/gegl-options.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/bin/gegl-options.c b/bin/gegl-options.c
index b10f1f248..a7290856a 100644
--- a/bin/gegl-options.c
+++ b/bin/gegl-options.c
@@ -182,10 +182,12 @@ print_key_value (const gchar *key,
gchar *token;
token = strtok (val, " \t\n\r");
- current_val_len = strlen (token);
- fprintf (stdout, "%-*s %s", padding, key, token);
+ if (token)
+ {
+ current_val_len = strlen (token);
+ fprintf (stdout, "%-*s %s", padding, key, token);
- while ((token = strtok (NULL, " \t\n\r")))
+ while ((token = strtok (NULL, " \t\n\r")))
{
if (current_val_len + strlen (token) > max_value_length)
{
@@ -200,6 +202,7 @@ print_key_value (const gchar *key,
}
fprintf (stdout, "\n");
+ }
g_free (val);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]