Skip to content

Commit 0856f82

Browse files
committed
Renderer/Html/Array: Fix Undefined offset for callback fixSpaces
It avoids breaking the callback when no spaces are to be counted. This is a fixup for 2900dd9 (#42)
1 parent 3cb3f7c commit 0856f82

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Diff/Renderer/Html/Array.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,13 @@ protected function formatLines($lines)
190190
*/
191191
private function fixSpaces(array $matches)
192192
{
193-
$spaces = $matches[1];
194-
$count = strlen($spaces);
195-
if($count == 0) {
193+
if (count($matches) < 2) {
196194
return '';
197195
}
198196

197+
$spaces = $matches[1];
198+
$count = strlen($spaces);
199+
199200
$div = floor($count / 2);
200201
$mod = $count % 2;
201202
return str_repeat('&nbsp; ', $div).str_repeat('&nbsp;', $mod);

0 commit comments

Comments
 (0)