image: Return an error if we got an empty or NULL minutiae array

In some cases nbim's get_minutiae returns no minutiae without providing an
error code, and if this happens we would crash in the task callback function
as we would try to deference the data->minutiae pointer.

Related to: #251
This commit is contained in:
Marco Trevisan (Treviño) 2020-04-24 19:59:55 +02:00
parent c0895a858d
commit 81e198c034

View file

@ -314,6 +314,14 @@ fp_image_detect_minutiae_thread_func (GTask *task,
return;
}
if (!data->minutiae || data->minutiae->num == 0)
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
"No minutiae found");
g_object_unref (task);
return;
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}