From b6dfea9c7d25b00a8dadbae1a372a4dbcf92bed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 29 Mar 2020 18:34:01 +0200 Subject: [PATCH] Fixed a invalid offset notice that can be occuring in GitVersionInfo. --- src/Services/GitVersionInfo.php | 7 +++++++ 1 file changed, 7 insertions(+) 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); }