mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-03 05:19:37 +00:00
fix: prevent TypeError in database General components with null server
Nullable server + guard to avoid TypeError/NPE. Don't terminate the app, terminate the bug. Changes: - Made Server property nullable (?Server $server = null) in all 8 database General components - Added guard clause in mount() to check for null server before accessing it - Displays user-friendly error message when destination server is not configured - Prevents crashes in methods like isLogDrainEnabled() and sslCertificates() Fixed components: - Mariadb, Dragonfly, Clickhouse, Keydb - Mysql, Mongodb, Redis, Postgresql 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
2aef2c383c
commit
74c70b431c
8 files changed
+48
-8
No files matched your search
@@ -18,7 +18,7 @@ class General extends Component
|
||||
{
|
||||
use AuthorizesRequests;
|
||||
|
||||
public Server $server;
|
||||
public ?Server $server = null;
|
||||
|
||||
public StandaloneRedis $database;
|
||||
|
||||
@@ -117,6 +117,11 @@ class General extends Component
|
||||
try {
|
||||
$this->syncData();
|
||||
$this->server = data_get($this->database, 'destination.server');
|
||||
if (! $this->server) {
|
||||
$this->dispatch('error', 'Database destination server is not configured.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$existingCert = $this->database->sslCertificates()->first();
|
||||
|
||||
|
||||
Reference in new issue
Block a user