search.php: - prevent script crash when usort() is performed on an empty database result, when using full-body search

This commit is contained in:
vga256 2023-07-05 21:07:45 -06:00 committed by Retro_Guy
parent 18559b6299
commit 72b83b55e5
1 changed files with 8 additions and 3 deletions

View File

@ -286,9 +286,14 @@ function get_body_search($group, $terms) {
}
$dbh = null;
}
usort($overview, function($a, $b) {
return $a['rank'] <=> $b['rank'];
});
// do not perform a usort of an empty search result
if ($overview != null)
{
usort($overview,
function($a, $b) {
return $a['rank'] <=> $b['rank'];
});
}
return $overview;
}