Skip to content
Snippets Groups Projects
Commit f4063f2c authored by Ere Maijala's avatar Ere Maijala Committed by Robert Lange
Browse files

Check that recommendations exist for a given config location. (#1517)

- Otherwise an invalid location param causes an error.
parent a5fe4b27
No related merge requests found
......@@ -132,7 +132,13 @@ class GetSideFacets extends \VuFind\AjaxHandler\AbstractBase
return $this->formatResponse('', self::STATUS_HTTP_ERROR);
}
$recommend = $results->getRecommendations($configLocation)[0];
$recommend = $results->getRecommendations($configLocation)[0] ?? null;
if (null === $recommend) {
return $this->formatResponse(
'Invalid config requested',
self::STATUS_HTTP_BAD_REQUEST
);
}
$context = [
'recommend' => $recommend,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment