diff --git a/examples/identify.c b/examples/identify.c index bc2fe00d..dc6a5d5c 100644 --- a/examples/identify.c +++ b/examples/identify.c @@ -143,6 +143,7 @@ on_identify_cb (FpDevice *dev, FpPrint *match, FpPrint *print, if (match) { g_autoptr(FpPrint) matched_print = g_object_ref (match); + const GDate *date; char date_str[128] = {}; identify_data->ret_value = EXIT_SUCCESS; @@ -155,7 +156,8 @@ on_identify_cb (FpDevice *dev, FpPrint *match, FpPrint *print, matched_print = g_steal_pointer (&stored_print); } - if (fp_print_get_enroll_date (matched_print)) + date = fp_print_get_enroll_date (matched_print); + if (date && g_date_valid (date)) g_date_strftime (date_str, G_N_ELEMENTS (date_str), "%Y-%m-%d\0", fp_print_get_enroll_date (matched_print)); else diff --git a/examples/manage-prints.c b/examples/manage-prints.c index 4d206cc9..88200a35 100644 --- a/examples/manage-prints.c +++ b/examples/manage-prints.c @@ -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); diff --git a/examples/verify.c b/examples/verify.c index 4b16323d..6892ef0e 100644 --- a/examples/verify.c +++ b/examples/verify.c @@ -130,12 +130,14 @@ on_match_cb (FpDevice *dev, FpPrint *match, FpPrint *print, if (match) { - char date_str[128]; + const GDate *date = fp_print_get_enroll_date (match); + char date_str[128] = ""; verify_data->ret_value = EXIT_SUCCESS; - g_date_strftime (date_str, G_N_ELEMENTS (date_str), "%Y-%m-%d\0", - fp_print_get_enroll_date (match)); + if (date && g_date_valid (date)) + g_date_strftime (date_str, G_N_ELEMENTS (date_str), "%Y-%m-%d\0", + fp_print_get_enroll_date (match)); g_debug ("Match report: device %s matched finger %s successifully " "with print %s, enrolled on date %s by user %s", fp_device_get_name (dev),