]> saetta.ns0.it Git - zakform/gdaex/commitdiff
Date and time can be NULL. master
authorAndrea Zagli <azagli@libero.it>
Sat, 2 Jan 2016 21:13:52 +0000 (22:13 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 2 Jan 2016 21:13:52 +0000 (22:13 +0100)
src/form.c

index 2b5ea3a970552f26e5f6cf85f56748dd80503fa0..07b0c95a6106d18deb59d279091282e4b645e191 100644 (file)
@@ -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)
                                {