From 280f6a131f4ea00718f353103bfe265462b607e6 Mon Sep 17 00:00:00 2001 From: Henrique Serrat Date: Fri, 13 Mar 2020 11:25:08 -0300 Subject: [PATCH] Check that is not null before calling preg_match --- src/Monolog/Processor/GitProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monolog/Processor/GitProcessor.php b/src/Monolog/Processor/GitProcessor.php index 9fc3f50f..cdf5ec73 100644 --- a/src/Monolog/Processor/GitProcessor.php +++ b/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],