scanimage: handle backends that provide options with null attributes

HPAIO backend in some instances provides options that have NULL name.
It might be that it is using SETTABLE flag to disable options rather
than removing them from the options list. Or it might just be a
backend bug.
release-1.2.x
Ralph Little 2023-02-04 16:16:54 -08:00
rodzic e3c1c0e000
commit b9fbe0b82e
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -926,7 +926,8 @@ fetch_options (SANE_Device * device)
}
/* create command line option only for non-group options */
if (opt->type == SANE_TYPE_GROUP)
/* Also we sometimes see options with no name in rogue backends. */
if ((opt->type == SANE_TYPE_GROUP) || (opt->name == NULL))
continue;
option_number[option_count] = i;
@ -2027,6 +2028,10 @@ static void print_options(SANE_Device * device, SANE_Int num_dev_options, SANE_B
if (!opt)
opt = sane_get_option_descriptor (device, i);
/* Some options from rogue backends are empty. */
if (opt->name == NULL)
continue;
if (ro || SANE_OPTION_IS_SETTABLE (opt->cap)
|| opt->type == SANE_TYPE_GROUP)
print_option (device, i, opt);