image: Check for task success rather than just cancellation

The minutiae detection might fail and we must not copy any data at that
point. So check g_task_had_error to ensure that we only do so when the
task was successful.

Fixes: #251
This commit is contained in:
Benjamin Berg 2020-04-24 17:56:45 +02:00 committed by Marco Trevisan (Treviño)
parent f71045b743
commit 5d5995f201

View file

@ -184,10 +184,8 @@ fp_image_detect_minutiae_cb (GObject *source_object,
GTask *task = G_TASK (res); GTask *task = G_TASK (res);
FpImage *image; FpImage *image;
DetectMinutiaeData *data = g_task_get_task_data (task); DetectMinutiaeData *data = g_task_get_task_data (task);
GCancellable *cancellable;
cancellable = g_task_get_cancellable (task); if (!g_task_had_error (task))
if (!cancellable || !g_cancellable_is_cancelled (cancellable))
{ {
gint i; gint i;
image = FP_IMAGE (source_object); image = FP_IMAGE (source_object);