LOC fix if file is corrupted

This commit is contained in:
Dennis Eichhorn 2016-07-16 11:48:39 +02:00
parent d2de70d356
commit 62f0a8da09

View File

@ -642,10 +642,14 @@ class Repository
continue;
}
$fh = fopen($path = $this->getDirectoryPath() . ($this->bare ? '/' : '/../') . $line, 'r');
if(!file_exists($path = $this->getDirectoryPath() . ($this->bare ? '/' : '/../') . $line)) {
return 0;
}
$fh = fopen($path, 'r');
if (!$fh) {
throw new PathException($path);
return 0;
}
while (!feof($fh)) {
@ -844,6 +848,7 @@ class Repository
throw new \Exception('Invalid commit id');
}
// todo: validate if array values are all initialized
$author = explode(':', $lines[1]);
$author = explode('<', trim($author[1]));
$date = substr($lines[2], 6);