Explorar el Código

Merge pull request #1438 from rickserrat/hotfix/gitprocessor

Check that  is not null before calling preg_match
Jordi Boggiano hace 5 años
padre
commit
5c670ec3d2
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/Monolog/Processor/GitProcessor.php

+ 1 - 1
src/Monolog/Processor/GitProcessor.php

@@ -52,7 +52,7 @@ class GitProcessor implements ProcessorInterface
         }
 
         $branches = `git branch -v --no-abbrev`;
-        if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
+        if ($branches && preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
             return self::$cache = array(
                 'branch' => $matches[1],
                 'commit' => $matches[2],