Prevent use of empty filters in FilterChain::toQueryString()

Due to instantiation of filters using Filter::matchAll() in ObjectList::getFilter(), we get an empty FilterAnd instance when
$this->filter is null. This prepends unnecessary separator '&' to the query string during conversion of filter to querystring.
This breaks the state badge links for host and service lists.
This commit is contained in:
raviks789 2022-04-28 14:52:06 +02:00 committed by Johannes Meyer
parent c5cf7abf0d
commit 199ea6f965
1 changed files with 3 additions and 1 deletions

View File

@ -171,8 +171,10 @@ abstract class FilterChain extends Filter
return '';
}
foreach ($this->filters() as $filter) {
if (! $filter->isEmpty()) {
$parts[] = $filter->toQueryString();
}
}
// TODO: getLevel??
if (strpos($this->getId(), '-')) {