From: Andrea Zagli Date: Sun, 15 May 2016 09:28:43 +0000 (+0200) Subject: ZakFormValidatorCompareDate now returns true if both elements are null (closes #1016). X-Git-Tag: debian/0.0.1-1~2 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=bf54f3b571f45217e0be6441f1037441d4498708;p=zakform%2Flibzakform ZakFormValidatorCompareDate now returns true if both elements are null (closes #1016). --- diff --git a/src/formvalidatorcomparedate.c b/src/formvalidatorcomparedate.c index 5de341e..ba0a04c 100644 --- a/src/formvalidatorcomparedate.c +++ b/src/formvalidatorcomparedate.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Andrea Zagli + * Copyright (C) 2015-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -265,6 +265,11 @@ zak_form_validator_compare_date_validate (ZakFormValidator *validator) gdt2 = zak_utils_get_gdatetime_from_string (zak_form_element_get_value (priv->v2), priv->format2); if (gdt1 == NULL + && gdt2 == NULL) + { + return TRUE; + } + else if (gdt1 == NULL || gdt2 == NULL) { if (priv->type == LESSER @@ -319,6 +324,15 @@ zak_form_validator_compare_date_validate (ZakFormValidator *validator) zak_form_validator_set_message (validator, msg); g_free (msg); } + + if (gdt1 != NULL) + { + g_date_time_unref (gdt1); + } + if (gdt2 != NULL) + { + g_date_time_unref (gdt2); + } } return ret;