diff --git a/libfprint/drivers/crfpmoc/crfpmoc.c b/libfprint/drivers/crfpmoc/crfpmoc.c index 00f127d7..45648ce1 100644 --- a/libfprint/drivers/crfpmoc/crfpmoc.c +++ b/libfprint/drivers/crfpmoc/crfpmoc.c @@ -800,6 +800,7 @@ static void handle_enroll_commit(FpiSsm *ssm, FpDevice *device, guint8 *template = NULL; guint16 ec_max_outsize = 10; struct crfpmoc_ec_response_fp_info info; + gboolean r = 0; crfpmoc_cmd_fp_info(self, &enrolled_templates, &error); fp_dbg("Number of enrolled templates is: %d", enrolled_templates); @@ -809,9 +810,20 @@ static void handle_enroll_commit(FpiSsm *ssm, FpDevice *device, g_object_set(enroll_print->print, "description", user_id, NULL); - gboolean r = crfpmoc_fp_download_template(self, &info, enrolled_templates - 1, - &template, &error); r = crfpmoc_ec_max_outsize(self, &ec_max_outsize, &error); + if (!r) { + fp_err("Failed to get max outsize"); + crfpmoc_set_print_data(enroll_print->print, enrolled_templates - 1, NULL, 0, + ec_max_outsize, info.template_max); + fpi_ssm_mark_failed( + ssm, fpi_device_retry_new_msg(FP_DEVICE_RETRY_GENERAL, + "Failed to get max outsize")); + return; + } + + + r = crfpmoc_fp_download_template(self, &info, enrolled_templates - 1, + &template, &error); if (!r) { fp_err("Failed to download template");