diff --git a/meta/definitions/software.php b/meta/definitions/software.php index 3d9a3b8..02c7383 100644 --- a/meta/definitions/software.php +++ b/meta/definitions/software.php @@ -83,11 +83,11 @@ return [ $gitdir = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . ".git" . DIRECTORY_SEPARATOR; if ( file_exists($gitdir . "HEAD") ) { - if (false !== ($currentBranch = file_get_contents($gitdir . "HEAD"))) { + if (false !== ($currentBranch = file_get_contents($gitdir . "HEAD"))) { $file = explode(": ", $currentBranch)[1]; $path = $gitdir . str_replace("/", DIRECTORY_SEPARATOR, trim($file, " \t\n\r")); - return trim(file_get_contents($path), " \t\n\r"); + return file_exists($path) ? trim(file_get_contents($path), " \t\n\r") : null; } }