# Insert a comment about the new attachment into the database.
my $comment = $cgi->param('comment');
+ $comment = '' unless defined $comment;
$bug->add_comment($comment, { isprivate => $attachment->isprivate,
type => CMT_ATTACHMENT_CREATED,
extra_data => $attachment->id });
# If the user submitted a comment while editing the attachment,
# add the comment to the bug. Do this after having validated isprivate!
my $comment = $cgi->param('comment');
- if (trim($comment)) {
+ if (defined $comment && trim($comment) ne '') {
$bug->add_comment($comment, { isprivate => $attachment->isprivate,
type => CMT_ATTACHMENT_UPDATED,
extra_data => $attachment->id });