From: rkinyon Date: Wed, 20 Dec 2006 05:54:05 +0000 (+0000) Subject: Fixed problem with how delete on an undef value was working X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26897a1c5f8db02a3ff231ba91d2ec32183d96d1;p=dbsrgits%2FDBM-Deep.git Fixed problem with how delete on an undef value was working --- diff --git a/lib/DBM/Deep/Engine3.pm b/lib/DBM/Deep/Engine3.pm index b1a5f33..15a8022 100644 --- a/lib/DBM/Deep/Engine3.pm +++ b/lib/DBM/Deep/Engine3.pm @@ -1039,7 +1039,7 @@ sub delete_key { my $location = $blist->get_data_location_for({ allow_head => 0, }); - my $old_value = $self->engine->_load_sector( $location ); + my $old_value = $location && $self->engine->_load_sector( $location ); if ( $self->engine->trans_id == 0 ) { my @transactions = $self->engine->read_transaction_slots; @@ -1059,8 +1059,11 @@ sub delete_key { $blist->mark_deleted( $args ); - my $data = $old_value->data; - $old_value->free; + my $data; + if ( $old_value ) { + $data = $old_value->data; + $old_value->free; + } return $data; }