From 61efd095150adee775c8d235a93c12b13939f0c8 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 24 Apr 2020 17:56:45 +0200 Subject: [PATCH] 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 --- libfprint/fp-image.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c index 6b63a438..5ccffabe 100644 --- a/libfprint/fp-image.c +++ b/libfprint/fp-image.c @@ -185,10 +185,8 @@ fp_image_detect_minutiae_cb (GObject *source_object, GTask *task = G_TASK (res); FpImage *image; DetectMinutiaeData *data = g_task_get_task_data (task); - GCancellable *cancellable; - cancellable = g_task_get_cancellable (task); - if (!cancellable || !g_cancellable_is_cancelled (cancellable)) + if (!g_task_had_error (task)) { gint i; image = FP_IMAGE (source_object);