From aacfeeb4742c9ba37b730e23b6441e0219cbfde4 Mon Sep 17 00:00:00 2001 From: Marcin Kasperski Date: Sun, 18 Nov 2012 00:38:10 +0100 Subject: [PATCH] (needs review) Resolved problem with warnings Use of uninitialized value within %map2name in hash element at /usr/local/share/perl/5.14.2/Crypt/PWSafe3/Record.pm line 140. occuring on true PasswordSafe file. I am not sure whether this could cause some data to be dropped, but the fix seems consistent with the other code. --- lib/Crypt/PWSafe3/Record.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Crypt/PWSafe3/Record.pm b/lib/Crypt/PWSafe3/Record.pm index 1492707..b4f7a0d 100644 --- a/lib/Crypt/PWSafe3/Record.pm +++ b/lib/Crypt/PWSafe3/Record.pm @@ -137,7 +137,11 @@ sub addfield { # # add a field to the record my ($this, $field) = @_; - $this->{field}->{ $map2name{$field->type} } = $field; + my $name = $map2name{$field->type}; + unless( defined($name) ) { + $name = $field->type; # consistent with Field->new + } + $this->{field}->{ $name } = $field; } =head1 NAME