From 6937d389472d63fe3fb251cbf733f8d21ba33950 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 May 2020 15:42:30 -0700 Subject: [PATCH] Fix an initialization issue in VectorTree Summary: Ref T13520. In unusual cases where there are no changes in a changeset list (e.g., empty commits) we can fatal when trying to iterate over an empty list of vectors. Test Plan: - Created an empty commit. - Used "git show | pbcopy" to create a diff from it. - Viewed it in the web UI. - Before: fatal when iterating on `null`. - After: clean page. Maniphest Tasks: T13520 Differential Revision: https://secure.phabricator.com/D21221 --- src/difference/ArcanistDiffVectorTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/difference/ArcanistDiffVectorTree.php b/src/difference/ArcanistDiffVectorTree.php index f0a3b72d..8573b939 100644 --- a/src/difference/ArcanistDiffVectorTree.php +++ b/src/difference/ArcanistDiffVectorTree.php @@ -3,7 +3,7 @@ final class ArcanistDiffVectorTree extends Phobject { - private $vectors; + private $vectors = array(); public function addVector(array $vector) { $this->vectors[] = $vector;