examples: Check whether the returned date is valid

Prints may have an invalid date. Extend the checks so that this is also
caught in addition to a NULL date.
This commit is contained in:
Benjamin Berg
2022-01-28 17:30:37 +01:00
parent ae5696a9bb
commit 168ab98021
3 changed files with 9 additions and 5 deletions

View File

@@ -161,7 +161,7 @@ on_list_completed (FpDevice *dev,
finger_to_string (fp_print_get_finger (print)),
fp_print_get_username (print));
if (date)
if (date && g_date_valid (date))
{
g_date_strftime (buf, G_N_ELEMENTS (buf), "%Y-%m-%d\0", date);
g_print (", enrolled on %s", buf);