diff --git a/PBot/DualIndexSQLiteObject.pm b/PBot/DualIndexSQLiteObject.pm index d8ee9258..60f56dfe 100644 --- a/PBot/DualIndexSQLiteObject.pm +++ b/PBot/DualIndexSQLiteObject.pm @@ -501,8 +501,10 @@ sub get_data { my $d = {}; foreach my $key (keys %{$stuff->[0]}) { next if $key eq 'index1' or $key eq 'index2'; - $self->{cache}->{$lc_index1}->{$lc_index2}->{$key} = $stuff->[0]->{$key}; - $d->{$key} = $stuff->[0]->{key} if defined $stuff->[0]->{key}; + if (defined $stuff->[0]->{$key}) { + $self->{cache}->{$lc_index1}->{$lc_index2}->{$key} = $stuff->[0]->{$key}; + $d->{$key} = $stuff->[0]->{$key}; + } } my $timeout = $self->{pbot}->{registry}->get_value('dualindexsqliteobject', 'cache_timeout') // 60 * 30; diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 862e7ba1..18f4ecfe 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -130,8 +130,8 @@ sub add_factoid { }; } - $self->{commands}->log_factoid($channel, $trigger, $owner, "created: $action") unless $dont_save; $self->{factoids}->add($channel, $trigger, $data, $dont_save); + $self->{commands}->log_factoid($channel, $trigger, $owner, "created: $action") unless $dont_save; } sub remove_factoid {