Skip to content

Commit

Permalink
When there is no filter form the admin list view should not crash
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Aug 7, 2020
1 parent bc0da36 commit 583fd4c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions libraries/src/MVC/Model/ListModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ public function getStart()
*/
public function getFilterForm($data = array(), $loadData = true)
{
$form = null;

// Try to locate the filter form automatically. Example: ContentModelArticles => "filter_articles"
if (empty($this->filterFormName))
{
Expand All @@ -362,13 +360,21 @@ public function getFilterForm($data = array(), $loadData = true)
}
}

if (!empty($this->filterFormName))
if (empty($this->filterFormName))
{
return null;
}

try
{
// Get the form.
$form = $this->loadForm($this->context . '.filter', $this->filterFormName, array('control' => '', 'load_data' => $loadData));
return $this->loadForm($this->context . '.filter', $this->filterFormName, array('control' => '', 'load_data' => $loadData));
}
catch (\RuntimeException $e)
{
}

return $form;
return null;
}

/**
Expand Down

0 comments on commit 583fd4c

Please sign in to comment.