From 95f2cfdd55990a91c29cde4bb8fd68e25a8950a6 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 29 Jan 2020 14:09:09 -0800 Subject: [PATCH] DualIndexHashObject: fix removing secondary index on "empty" --- PBot/DualIndexHashObject.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PBot/DualIndexHashObject.pm b/PBot/DualIndexHashObject.pm index 3943528c..ba9c5e0c 100644 --- a/PBot/DualIndexHashObject.pm +++ b/PBot/DualIndexHashObject.pm @@ -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}; }