Skip to content

Commit

Permalink
Renderer/Html/Array: Fix Undefined offset for callback fixSpaces
Browse files Browse the repository at this point in the history
It avoids breaking the callback when no spaces are to be counted.

This is a fixup for 2900dd9 (#42)
  • Loading branch information
lazyfrosch committed May 9, 2018
1 parent 3cb3f7c commit cb0d078
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Diff/Renderer/Html/Array.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,14 @@ protected function formatLines($lines)
*/
private function fixSpaces(array $matches)
{
$spaces = $matches[1];
$count = strlen($spaces);
if($count == 0) {
$count = 0;

if (count($matches) > 1) {
$spaces = $matches[1];
$count = strlen($spaces);
}

if ($count == 0) {
return '';
}

Expand Down

0 comments on commit cb0d078

Please sign in to comment.