From bf54f3b571f45217e0be6441f1037441d4498708 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 15 May 2016 11:28:43 +0200 Subject: [PATCH] ZakFormValidatorCompareDate now returns true if both elements are null (closes #1016). --- src/formvalidatorcomparedate.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; -- 2.49.0