diff --git a/lib/Gscan2pdf/Dialog/Scan/Sane.pm b/lib/Gscan2pdf/Dialog/Scan/Sane.pm index 8d35b05..647952d 100644 --- a/lib/Gscan2pdf/Dialog/Scan/Sane.pm +++ b/lib/Gscan2pdf/Dialog/Scan/Sane.pm @@ -728,6 +728,7 @@ sub set_option_widget { elsif ( defined $widget ) { given ($widget) { when ( $widget->isa('Gtk2::CheckButton') ) { + if ( $val eq '' ) { $val = 0 } if ( $widget->get_active != $val ) { $widget->set_active($val); return $i; diff --git a/lib/Gscan2pdf/Frontend/Sane.pm b/lib/Gscan2pdf/Frontend/Sane.pm index 6930989..cc580f8 100644 --- a/lib/Gscan2pdf/Frontend/Sane.pm +++ b/lib/Gscan2pdf/Frontend/Sane.pm @@ -422,6 +424,8 @@ sub _thread_get_options { sub _thread_set_option { my ( $self, $index, $value, $new_options ) = @_; + my $opt = $self->{device_handle}->get_option_descriptor($index); + if ( $opt->{type} == SANE_TYPE_BOOL and $value eq '' ) { $value = 0 } # FIXME: Stringification to force this SV to have a PV slot. This seems to # be necessary to get through Sane.pm's value checks. @@ -430,7 +434,6 @@ sub _thread_set_option { my $info = $self->{device_handle}->set_option( $index, $value ); if ( $logger->is_info ) { my $status = $Sane::STATUS; - my $opt = $self->{device_handle}->get_option_descriptor($index); $logger->info( "sane_set_option $index ($opt->{name}) to $value returned status $status with info $info" );