diff --git a/lib/Diff/Renderer/Html/Array.php b/lib/Diff/Renderer/Html/Array.php
index 521601c6..2fe96254 100644
--- a/lib/Diff/Renderer/Html/Array.php
+++ b/lib/Diff/Renderer/Html/Array.php
@@ -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 '';
}