Prevent error from occurring when the active sorting column is hidden from the results.

Fixes #5227
This commit is contained in:
Luke Towers 2020-07-30 10:54:09 -06:00
parent b1954e9258
commit 18af35d928

View File

@ -522,7 +522,7 @@ class Lists extends WidgetBase
/*
* Apply sorting
*/
if (($sortColumn = $this->getSortColumn()) && !$this->showTree) {
if (($sortColumn = $this->getSortColumn()) && !$this->showTree && in_array($sortColumn, array_keys($this->getVisibleColumns()))) {
if (($column = array_get($this->allColumns, $sortColumn)) && $column->valueFrom) {
$sortColumn = $this->isColumnPivot($column)
? 'pivot_' . $column->valueFrom