diff options
author | Byron Jones <glob@mozilla.com> | 2015-04-14 15:36:53 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-04-14 15:36:53 +0200 |
commit | 4fbbdbc95a7959a5cf8ecb5df7126c76e52a06fe (patch) | |
tree | 376393694c25223e92f19403348b54e7ad3b0478 /extensions | |
parent | c042bf8ce8e46b6eea617dc5191df6da28a1f390 (diff) | |
download | bugzilla-4fbbdbc95a7959a5cf8ecb5df7126c76e52a06fe.tar.gz bugzilla-4fbbdbc95a7959a5cf8ecb5df7126c76e52a06fe.tar.xz |
Bug 1154252: Bug 1146767: triggers method on undefined value warning
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/BugModal/lib/Util.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/extensions/BugModal/lib/Util.pm b/extensions/BugModal/lib/Util.pm index daca86518..74311197a 100644 --- a/extensions/BugModal/lib/Util.pm +++ b/extensions/BugModal/lib/Util.pm @@ -25,7 +25,13 @@ sub date_str_to_time { return timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900); } state $tz //= DateTime::TimeZone->new( name => 'local' ); - return datetime_from($date, $tz)->epoch; + my $dt = datetime_from($date, $tz); + if (!$dt) { + # this should never happen + warn("invalid datetime '$date'"); + return undef; + } + return $dt->epoch; } 1; |