mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Add a missing "null" check when rebuilding old/new diff content
Summary: See <https://discourse.phabricator-community.org/t/exceptions-when-viewing-diffs/3787>. This list may include `null` values. Until PHP 7.4, `$x = null; echo $x['y'];` does not emit a warning. Sneaky! Test Plan: - Traced `null` values from `reparseHunksForSpecialAttributes()`, saw them no longer incorporated into corpus bodies. - This has some amount of test coverage. Differential Revision: https://secure.phabricator.com/D21169
This commit is contained in:
parent
454ecb56e3
commit
40d2346f29
1 changed files with 5 additions and 0 deletions
|
@ -456,6 +456,11 @@ final class DifferentialHunkParser extends Phobject {
|
||||||
|
|
||||||
$corpus = array();
|
$corpus = array();
|
||||||
foreach ($lines as $l) {
|
foreach ($lines as $l) {
|
||||||
|
if ($l === null) {
|
||||||
|
$corpus[] = "\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($l['type'] != '\\') {
|
if ($l['type'] != '\\') {
|
||||||
if ($l['text'] === null) {
|
if ($l['text'] === null) {
|
||||||
// There's no text on this side of the diff, but insert a placeholder
|
// There's no text on this side of the diff, but insert a placeholder
|
||||||
|
|
Loading…
Reference in a new issue