From: Andrea Zagli Date: Sat, 2 Jan 2016 21:13:52 +0000 (+0100) Subject: Date and time can be NULL. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=HEAD;p=zakform%2Fgdaex Date and time can be NULL. --- 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) {