1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix an invalid index access for synthetic lint inline comments from Harbormaster

Summary:
Ref T13524. If a Harbormaster lint message has no line number (which is permitted), we try to access an invalid index here. This is an exception after D21044.

Treat comments with no line number as unchanged. These comments do not have "ghost" behavior and do not port across diffs.

Test Plan:
  - Used "harbormaster.sendmessage" to submit lint with no line number on a changeset.
  - Viewed changeset.
    - Before patch: "Undefined index: <null>" error.
    - After patch: Clean changeset with lint message.

{F7400072}

Maniphest Tasks: T13524

Differential Revision: https://secure.phabricator.com/D21178
This commit is contained in:
epriestley 2020-04-27 14:15:29 -07:00
parent 6617005365
commit aa20faeaa5

View file

@ -980,10 +980,15 @@ final class DifferentialChangesetParser extends Phobject {
$new_side = $this->isCommentOnRightSideWhenDisplayed($comment);
$line = $comment->getLineNumber();
if ($new_side) {
$back_line = $new_backmap[$line];
// See T13524. Lint inlines from Harbormaster may not have a line
// number.
if ($line === null) {
$back_line = null;
} else if ($new_side) {
$back_line = idx($new_backmap, $line);
} else {
$back_line = $old_backmap[$line];
$back_line = idx($old_backmap, $line);
}
if ($back_line != $line) {
@ -1002,7 +1007,6 @@ final class DifferentialChangesetParser extends Phobject {
$comment->setLineNumber($back_line);
$comment->setLineLength(0);
}
$start = max($comment->getLineNumber() - $lines_context, 0);