From 86470e7a308fa9d65ff8957deb829590ac59dc2c Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 6 Dec 2012 07:52:33 -0800 Subject: [PATCH] Handle empty lines in makeChangesWithContext() Summary: Happens on the end of hunk. Test Plan: $ ./reparse.php Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4091 --- .../differential/storage/DifferentialChangeset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php index abf3ba7f67..9e5466c660 100644 --- a/src/applications/differential/storage/DifferentialChangeset.php +++ b/src/applications/differential/storage/DifferentialChangeset.php @@ -137,7 +137,8 @@ final class DifferentialChangeset extends DifferentialDAO { $context = array(); $changes = explode("\n", $hunk->getChanges()); foreach ($changes as $l => $line) { - if ($line[0] == '+' || $line[0] == '-') { + $type = substr($line, 0, 1); + if ($type == '+' || $type == '-') { $context += array_fill($l - $num_lines, 2 * $num_lines + 1, true); } }