3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 05:49:27 +01:00

Plugins/Spinach.pm: ensure category filters have content before applying

This commit is contained in:
Pragmatic Software 2020-01-21 20:22:12 -08:00
parent af99023160
commit d26be547c2

View File

@ -1654,13 +1654,13 @@ sub choosecategory {
my @choices;
my @categories;
if (exists $self->{metadata}->{hash}->{filter}->{category_include_filter}) {
if (exists $self->{metadata}->{hash}->{filter}->{category_include_filter} and length $self->{metadata}->{hash}->{filter}->{category_include_filter}) {
@categories = grep { /$self->{metadata}->{hash}->{filter}->{category_include_filter}/i } keys %{$self->{categories}};
} else {
@categories = keys %{$self->{categories}};
}
if (exists $self->{metadata}->{hash}->{filter}->{category_exclude_filter}) {
if (exists $self->{metadata}->{hash}->{filter}->{category_exclude_filter} and length $self->{metadata}->{hash}->{filter}->{category_exclude_filter}) {
@categories = grep { $_ !~ /$self->{metadata}->{hash}->{filter}->{category_exclude_filter}/i } @categories;
}