Bugfix: Crash when no env initialized
This commit is contained in:
parent
0f45219747
commit
8f7e8013ab
@ -15,7 +15,7 @@ class SparkApplication extends Application
|
||||
{
|
||||
public static SparkApplication $instance;
|
||||
|
||||
private Environment $environment;
|
||||
private ?Environment $environment;
|
||||
|
||||
private ResourceManager $resourceManager;
|
||||
|
||||
@ -32,20 +32,23 @@ class SparkApplication extends Application
|
||||
$this->pluginManager = new PluginManager();
|
||||
|
||||
$this->environment = Environment::createFromDirectory(null, true);
|
||||
$this->environment->loadEnvironment();
|
||||
if ($this->environment) {
|
||||
$this->environment->loadEnvironment();
|
||||
|
||||
$this->add(new Commands\RunCommand());
|
||||
$this->add(new Commands\ResourcesCommand());
|
||||
$this->add(new Commands\ReplCommand());
|
||||
$this->add(new Commands\InitCommand());
|
||||
$this->add(new Commands\PipeCommand());
|
||||
$this->add(new Commands\RunCommand());
|
||||
$this->add(new Commands\ResourcesCommand());
|
||||
$this->add(new Commands\ReplCommand());
|
||||
$this->add(new Commands\PipeCommand());
|
||||
|
||||
$this->get("list")->setHidden(true);
|
||||
$this->get("completion")->setHidden(true);
|
||||
$this->get("help")->setHidden(true);
|
||||
$this->get("list")->setHidden(true);
|
||||
$this->get("completion")->setHidden(true);
|
||||
$this->get("help")->setHidden(true);
|
||||
|
||||
if (getenv("SPARK_PLUGINS")) {
|
||||
$this->add(new Commands\PluginsCommand());
|
||||
if (getenv("SPARK_PLUGINS")) {
|
||||
$this->add(new Commands\PluginsCommand());
|
||||
}
|
||||
} else {
|
||||
$this->add(new Commands\InitCommand());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user