From 78704e55488073c03b8dbcfb4e605cb003a06a8c Mon Sep 17 00:00:00 2001 From: Leo Feyer Date: Wed, 9 Oct 2013 13:25:33 +0200 Subject: [PATCH] Only create a new model registry if a connection could be established --- system/modules/core/library/Contao/Database.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/modules/core/library/Contao/Database.php b/system/modules/core/library/Contao/Database.php index 6105586434..d2f256d7d8 100644 --- a/system/modules/core/library/Contao/Database.php +++ b/system/modules/core/library/Contao/Database.php @@ -81,12 +81,13 @@ protected function __construct(array $arrConfig) { $this->arrConfig = $arrConfig; $this->connect(); - $this->objModelRegistry = new \Model\Registry($this); if (!is_resource($this->resConnection) && !is_object($this->resConnection)) { throw new \Exception(sprintf('Could not connect to database (%s)', $this->error)); } + + $this->objModelRegistry = new \Model\Registry($this); }