(Fix) search result renders empty element

Resubmitted the change again.
When the $page posted back, it maybe 0. In order to use it for array index, we need to avoid negative value after deducting it by 1.
That 0 case occurs when the searching takes place at default Group View loading. On the other hand, if the searching combined with a click on Paginator, the Paginator already posts a correct $page value instead of 0.
This commit is contained in:
Morgan Wong
2019-04-28 15:23:57 +08:00
committed by GitHub
parent 2db590e1f7
commit c79078daaf
@@ -661,6 +661,9 @@ class TorrentController extends Controller
$hungry = array_chunk($prelauncher, $qty);
$fed = [];
if ($page < 1) {
$page = 1;
}
if (is_array($hungry) && array_key_exists($page - 1, $hungry)) {
$fed = $hungry[$page - 1];
}
@@ -725,6 +728,9 @@ class TorrentController extends Controller
$hungry = array_chunk($prelauncher, $qty);
$fed = [];
if ($page < 1) {
$page = 1;
}
if (is_array($hungry) && array_key_exists($page - 1, $hungry)) {
$fed = $hungry[$page - 1];
}