From 47ac5e2668aabca5a2d7e59d60296aac7ab1a362 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 18 Dec 2022 14:59:40 +0100 Subject: [PATCH] Added a null check to HTTPSessionManagerDB, and small cleanups. --- modules/web/database/http_session_manager_db.cpp | 6 +++--- modules/web/http/http_session_manager.cpp | 1 - modules/web/register_types.cpp | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/web/database/http_session_manager_db.cpp b/modules/web/database/http_session_manager_db.cpp index 900d095eb..2c681c43c 100644 --- a/modules/web/database/http_session_manager_db.cpp +++ b/modules/web/database/http_session_manager_db.cpp @@ -125,11 +125,9 @@ void HTTPSessionManagerDB::save_session(Ref session) { while ((k = m->next(k))) { const Variant &val = m->get(*k); - Variant::Type t = val.get_type(); - // Maybe it should be allowed? // Or maybe when adding stuff to the sessions the method should have a store = true bool, if false skip saving - if (t == Variant::OBJECT) { + if (val.get_type() == Variant::OBJECT) { continue; } @@ -146,6 +144,8 @@ void HTTPSessionManagerDB::load_sessions() { Ref b = get_query_builder(); + ERR_FAIL_COND(!b.is_valid()); + b->select("id, session_id"); b->from(_database_table_name); // b->print(); diff --git a/modules/web/http/http_session_manager.cpp b/modules/web/http/http_session_manager.cpp index 7c480c9f2..dc2cea2de 100644 --- a/modules/web/http/http_session_manager.cpp +++ b/modules/web/http/http_session_manager.cpp @@ -98,7 +98,6 @@ Ref HTTPSessionManager::create_session() { } void HTTPSessionManager::load_sessions() { - clear(); } void HTTPSessionManager::clear() { diff --git a/modules/web/register_types.cpp b/modules/web/register_types.cpp index d1cf90fdd..3088e17e8 100644 --- a/modules/web/register_types.cpp +++ b/modules/web/register_types.cpp @@ -137,7 +137,6 @@ void register_web_types() { #ifdef MODULE_DATABASE_ENABLED ClassDB::register_class(); - #endif #if TOOLS_ENABLED