Skip to content

Commit cb0d078

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 cb0d078

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/Diff/Renderer/Html/Array.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,14 @@ 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+
$count = 0;
194+
195+
if (count($matches) > 1) {
196+
$spaces = $matches[1];
197+
$count = strlen($spaces);
198+
}
199+
200+
if ($count == 0) {
196201
return '';
197202
}
198203

0 commit comments

Comments
 (0)