diff --git a/src/Providers/AddonServiceProvider.php b/src/Providers/AddonServiceProvider.php index af4d04c6bb..10317262cc 100644 --- a/src/Providers/AddonServiceProvider.php +++ b/src/Providers/AddonServiceProvider.php @@ -728,7 +728,15 @@ protected function bootFieldsets() protected function autoloadFilesFromFolder($folder, $requiredClass) { - $addon = $this->getAddon(); + try { + $addon = $this->getAddon(); + } catch (NotBootedException $e) { + // This would be thrown if a developer has tried to call a method + // that triggers autoloading before Statamic has booted. Perhaps + // they have placed it in the boot method instead of bootAddon. + return []; + } + $path = $addon->directory().$addon->autoload().'/'.$folder; if (! $this->app['files']->exists($path)) {