Bug 5415 Let calls of SimpleSearch utilize considtent interface
[koha.git] / cataloguing / value_builder / unimarc_field_4XX.pl
index 84a6208..ddb6547 100755 (executable)
@@ -335,7 +335,10 @@ sub plugin {
         my $orderby;
         $search = 'kw,wrdl='.$search.' and mc-itemtype='.$itype if $itype;
         my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
-        my $total = scalar(@$results);
+        if (defined $errors ) {
+            $results = [];
+        }
+        my $total = @{$results};
 
         #        warn " biblio count : ".$total;