Skip to content

Commit 43a9f2d

Browse files
committed
bug #574 Fix console error listener when there is no command yet (ogizanagi)
This PR was merged into the master branch. Discussion ---------- Fix console error listener when there is no command yet Fixes an issue when there isn't any command yet and an error was triggered. For instance, when trying to use a non-existing command. > PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getName() on null in src/AppBundle/EventListener/CheckRequirementsSubscriber.php:70 Commits ------- 81c459d Fix console error listener when there is no command yet
2 parents a99f756 + 81c459d commit 43a9f2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AppBundle/EventListener/CheckRequirementsSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function handleConsoleError(ConsoleErrorEvent $event)
6767
{
6868
$commandNames = ['doctrine:fixtures:load', 'doctrine:database:create', 'doctrine:schema:create', 'doctrine:database:drop'];
6969

70-
if (in_array($event->getCommand()->getName(), $commandNames, true)) {
70+
if ($event->getCommand() && in_array($event->getCommand()->getName(), $commandNames, true)) {
7171
if ($this->isSQLitePlatform() && !extension_loaded('sqlite3')) {
7272
$io = new SymfonyStyle($event->getInput(), $event->getOutput());
7373
$io->error('This command requires to have the "sqlite3" PHP extension enabled because, by default, the Symfony Demo application uses SQLite to store its information.');

0 commit comments

Comments
 (0)