Commit b9af7952 authored by Bastien Nocera's avatar Bastien Nocera

demo: Fix crash when there are no supported devices

Handle the empty list output from fp_discover_devs() when there are no
supported devices.

Closes: #146
parent ea6820ed
...@@ -473,8 +473,17 @@ libfprint_demo_window_init (LibfprintDemoWindow *window) ...@@ -473,8 +473,17 @@ libfprint_demo_window_init (LibfprintDemoWindow *window)
setup_pollfds (); setup_pollfds ();
discovered_devs = fp_discover_devs(); discovered_devs = fp_discover_devs();
if (!discovered_devs) if (!discovered_devs) {
libfprint_demo_set_mode (window, ERROR_MODE);
return; return;
}
/* Empty list? */
if (discovered_devs[0] == NULL) {
fp_dscv_devs_free (discovered_devs);
libfprint_demo_set_mode (window, EMPTY_MODE);
return;
}
if (!fp_driver_supports_imaging(fp_dscv_dev_get_driver(discovered_devs[0]))) { if (!fp_driver_supports_imaging(fp_dscv_dev_get_driver(discovered_devs[0]))) {
libfprint_demo_set_mode (window, NOIMAGING_MODE); libfprint_demo_set_mode (window, NOIMAGING_MODE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment