Added a null check to HTTPSessionManagerDB, and small cleanups.

This commit is contained in:
Relintai 2022-12-18 14:59:40 +01:00
parent b8b51e7525
commit 47ac5e2668
3 changed files with 3 additions and 5 deletions

View File

@ -125,11 +125,9 @@ void HTTPSessionManagerDB::save_session(Ref<HTTPSession> session) {
while ((k = m->next(k))) { while ((k = m->next(k))) {
const Variant &val = m->get(*k); const Variant &val = m->get(*k);
Variant::Type t = val.get_type();
// Maybe it should be allowed? // 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 // 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; continue;
} }
@ -146,6 +144,8 @@ void HTTPSessionManagerDB::load_sessions() {
Ref<QueryBuilder> b = get_query_builder(); Ref<QueryBuilder> b = get_query_builder();
ERR_FAIL_COND(!b.is_valid());
b->select("id, session_id"); b->select("id, session_id");
b->from(_database_table_name); b->from(_database_table_name);
// b->print(); // b->print();

View File

@ -98,7 +98,6 @@ Ref<HTTPSession> HTTPSessionManager::create_session() {
} }
void HTTPSessionManager::load_sessions() { void HTTPSessionManager::load_sessions() {
clear();
} }
void HTTPSessionManager::clear() { void HTTPSessionManager::clear() {

View File

@ -137,7 +137,6 @@ void register_web_types() {
#ifdef MODULE_DATABASE_ENABLED #ifdef MODULE_DATABASE_ENABLED
ClassDB::register_class<HTTPSessionManagerDB>(); ClassDB::register_class<HTTPSessionManagerDB>();
#endif #endif
#if TOOLS_ENABLED #if TOOLS_ENABLED