Skip to content

Commit 090d940

Browse files
committed
fix(database): Logic Error
1 parent 4409128 commit 090d940

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/scripting/network/database.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ LoadScriptingComponent(database, [](PluginObject plugin, EContext* ctx) -> void
4141
if (!shouldSkipDefaultConnection) db = g_dbManager.GetDatabase("default_connection");
4242
}
4343

44-
if (!db->Connect()) {
45-
PRINTF("An error has occured while trying to connect to database \"%s\":\nError: %s\n", connection_name.c_str(), db->GetError().c_str());
44+
if (db) {
45+
if (!db->Connect()) {
46+
PRINTF("An error has occured while trying to connect to database \"%s\":\nError: %s\n", connection_name.c_str(), db->GetError().c_str());
47+
}
4648
}
4749

4850
data->SetData("db", db);

0 commit comments

Comments
 (0)