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

DualIndexHashObject: fix removing secondary index on "empty"

This commit is contained in:
Pragmatic Software 2020-01-29 14:09:09 -08:00
parent 4c3f752132
commit 95f2cfdd55

View File

@ -327,8 +327,8 @@ sub remove {
my $name2 = $data->{_name};
$name2 = "\"$name2\"" if $name2 =~ / /;
# remove primary group if no more secondaries
if (keys %{ $self->{hash}->{$lc_primary_index} } == 0) {
# remove primary group if no more secondaries (only key left should be the _name key)
if (keys %{ $self->{hash}->{$lc_primary_index} } == 1) {
delete $self->{hash}->{$lc_primary_index};
}