Bug 93182 - Do not crash on invalid bug numbers in today worktime

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1520 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2012-02-29 14:00:05 +00:00
parent 2135fe586d
commit e9e9dbfb62
2 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ sub FixWorktime
{
my ($bug, $wtime, $comment, $timestamp, $userid) = @_;
return 1 unless $wtime;
$bug = Bugzilla::Bug->new({ id => $bug, for_update => 1 }) unless ref $bug;
$bug = Bugzilla::Bug->check({ id => $bug, for_update => 1 }) unless ref $bug;
return 0 unless $bug;
return AddWorktime($bug, $comment, $timestamp, { ($userid || Bugzilla->user->id) => $wtime });
}

View File

@ -63,7 +63,7 @@ if (@idlist || @lines)
foreach my $line (@lines)
{
# New, intuitive format: BUG_ID <space> TIME <space> COMMENT
if ($line =~ /^\D*(\d+)\s*(?:(-?[\d\.\,]+)|(\d+):(\d{2}))\s*(.*)/iso)
if ($line =~ /^\D*(\d+)\s*(?:(-?\d[\d\.\,]*)|(\d+):(\d{2}))\s*(.*)/iso)
{
my ($id, $time, $comment) = ($1, $3 ? $3+$4/60 : $2, $5);
add_wt($wtime, $id, $time, $comment);