diff --git a/src/Services/GitVersionInfo.php b/src/Services/GitVersionInfo.php index a4753a5e..cdb74c8e 100644 --- a/src/Services/GitVersionInfo.php +++ b/src/Services/GitVersionInfo.php @@ -64,6 +64,9 @@ class GitVersionInfo $git = file($this->project_dir.'/.git/HEAD'); $head = explode('/', $git[0], 3); + if (!isset($head[2])) { + return null; + } return trim($head[2]); } @@ -86,6 +89,10 @@ class GitVersionInfo $head = file($filename); $hash = $head[0]; + if (!isset($head[0])) { + return null; + } + return substr($hash, 0, $length); }