diff --git a/app/init/resources.php b/app/init/resources.php index 295e6125ae..ef43ab2e09 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -565,8 +565,12 @@ Http::setResource('dbForProject', function (Group $pools, Database $dbForPlatfor return $dbForPlatform; } - $database = $project->getAttribute('database'); - if ($database === null || $database === '') { + if ($project->isEmpty()) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Project is not configured'); + } + + $database = $project->getAttribute('database', ''); + if (empty($database)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Project database is not configured'); }