kvs20xx.c: don't assume sane_get_devices() has been called

Nor that that function is called with a non-NULL argument.
This aligns the implementation with that of kvs40xx.c.

Fixes 315625.
merge-requests/1/head
Olaf Meeuwissen 2017-05-06 12:24:13 +09:00
rodzic 8995b1fc81
commit f3f8afb08c
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -156,7 +156,8 @@ sane_get_devices (const SANE_Device *** device_list,
known_devices[curr_scan_dev].scanner.model,
NULL, -1, -1, -1, -1, attach);
}
*device_list = (const SANE_Device **) devlist;
if(device_list)
*device_list = (const SANE_Device **) devlist;
return SANE_STATUS_GOOD;
}
@ -168,6 +169,12 @@ sane_open (SANE_String_Const devname, SANE_Handle * handle)
struct scanner *s;
SANE_Int h, bus;
SANE_Status st;
if (!devlist)
{
st = sane_get_devices (NULL, 0);
if (st)
return st;
}
for (i = 0; devlist[i]; i++)
{
if (!strcmp (devlist[i]->name, devname))