examples: Don't try to save an image from a print without it

A device may produce both prints with image data and not, so only do it
in the case the prints contains image data
This commit is contained in:
Marco Trevisan (Treviño) 2020-06-17 14:00:19 +02:00
parent ed26976ac5
commit 1f96077e36
2 changed files with 2 additions and 2 deletions

View file

@ -112,7 +112,7 @@ on_enroll_progress (FpDevice *device,
return; return;
} }
if (fp_device_supports_capture (device) && if (print && fp_print_get_image (print) &&
print_image_save (print, "enrolled.pgm")) print_image_save (print, "enrolled.pgm"))
printf ("Wrote scanned image to enrolled.pgm\n"); printf ("Wrote scanned image to enrolled.pgm\n");

View file

@ -124,7 +124,7 @@ on_match_cb (FpDevice *dev, FpPrint *match, FpPrint *print,
return; return;
} }
if (print && fp_device_supports_capture (dev) && if (print && fp_print_get_image (print) &&
print_image_save (print, "verify.pgm")) print_image_save (print, "verify.pgm"))
g_print ("Print image saved as verify.pgm\n"); g_print ("Print image saved as verify.pgm\n");