diff --git a/module/VuFind/src/VuFind/Autocomplete/Eds.php b/module/VuFind/src/VuFind/Autocomplete/Eds.php index 18094b556eb7d3e153b7faa4fa1ae0e89fd33ee2..2865685c2c5c43bae2f3207a6458e4f548a8d21e 100644 --- a/module/VuFind/src/VuFind/Autocomplete/Eds.php +++ b/module/VuFind/src/VuFind/Autocomplete/Eds.php @@ -84,20 +84,13 @@ class Eds implements AutocompleteInterface */ public function getSuggestions($query) { - // Initialize return array: - $results = []; - - if (!is_object($this->backend)) { - throw new \Exception('Please set configuration first.'); - } - try { // Perform the autocomplete search: $results = $this->backend->autocomplete($query, $this->domain); } catch (\Exception $e) { // Ignore errors -- just return empty results if we must. } - return isset($results) ? array_unique($results) : []; + return is_array($results ?? null) ? array_unique($results) : []; } /**