From 00166615b8f3d75eecbecf7cdb8cbd43caeefcf6 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 2 Jan 2016 22:13:52 +0100 Subject: [PATCH] Date and time can be NULL. --- src/form.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/form.c b/src/form.c index 2b5ea3a..07b0c95 100644 --- a/src/form.c +++ b/src/form.c @@ -227,7 +227,15 @@ static GValue datetime_format = (gchar *)g_hash_table_lookup (format, "content"); gdt = zak_utils_get_gdatetime_from_string (value, datetime_format); - ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%F")); + + if (gdt == NULL) + { + ret = gda_value_new_null (); + } + else + { + ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%F")); + } if (gdt != NULL) { @@ -242,7 +250,15 @@ static GValue datetime_format = (gchar *)g_hash_table_lookup (format, "content"); gdt = zak_utils_get_gdatetime_from_string (value, datetime_format); - ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%T")); + + if (gdt == NULL) + { + ret = gda_value_new_null (); + } + else + { + ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%T")); + } if (gdt != NULL) { @@ -257,7 +273,15 @@ static GValue datetime_format = (gchar *)g_hash_table_lookup (format, "content"); gdt = zak_utils_get_gdatetime_from_string (value, datetime_format); - ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%F %T")); + + if (gdt == NULL) + { + ret = gda_value_new_null (); + } + else + { + ret = zak_utils_gvalue_new_string (zak_utils_gdatetime_format (gdt, "%F %T")); + } if (gdt != NULL) { -- 2.49.0