From 8c38618625e587731f9e057c77cf6ac0a06e40b8 Mon Sep 17 00:00:00 2001 From: Dylan Lloyd Date: Wed, 16 Jan 2013 03:56:56 -0500 Subject: [PATCH] fixed unitialized warning when timezone !found fixed a warning that occurred when the timezone name parsed from $input_timezone was not found in the %timezones hash --- lib/DDG/Goodie/TimezoneConverter.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/DDG/Goodie/TimezoneConverter.pm b/lib/DDG/Goodie/TimezoneConverter.pm index 3e1b15358..d35944d98 100644 --- a/lib/DDG/Goodie/TimezoneConverter.pm +++ b/lib/DDG/Goodie/TimezoneConverter.pm @@ -146,7 +146,12 @@ handle query => sub { s/\s+//g; } my $gmt_input_timezone = parse_timezone $input_timezone; + # parse_timezone returns undef if the timezone name parsed + # from #input_timezone is not found in %timezones + return unless defined $gmt_input_timezone; + my $gmt_output_timezone = parse_timezone $output_timezone; + $modifier += $gmt_output_timezone - $gmt_input_timezone; for ( $gmt_input_timezone, $gmt_output_timezone ) { $_ = to_time $_;