From 3aeb6a8f2d98b4f3aaa3e5098d46ff87b59eade5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 31 May 2012 14:36:45 +0200 Subject: [PATCH] Minor robustness fix --- src/Composer/Repository/Vcs/GitDriver.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/Vcs/GitDriver.php b/src/Composer/Repository/Vcs/GitDriver.php index 038cff1e5..271e645c7 100644 --- a/src/Composer/Repository/Vcs/GitDriver.php +++ b/src/Composer/Repository/Vcs/GitDriver.php @@ -165,8 +165,9 @@ class GitDriver extends VcsDriver $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) { - preg_match('{^(?:\* )? *(?:[^/ ]+?/)?(\S+) *([a-f0-9]+) .*$}', $branch, $match); - $branches[$match[1]] = $match[2]; + if (preg_match('{^(?:\* )? *(?:[^/ ]+?/)?(\S+) *([a-f0-9]+) .*$}', $branch, $match)) { + $branches[$match[1]] = $match[2]; + } } }