From 7dae012f33e0968839bd420169e20111c0017031 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Fri, 1 Jul 2022 02:22:40 +0700 Subject: [PATCH] Change database API to validate new dbs' names --- sources/Data/Database/DBAPI.uc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/Data/Database/DBAPI.uc b/sources/Data/Database/DBAPI.uc index 8d29c02..9fd8ed0 100644 --- a/sources/Data/Database/DBAPI.uc +++ b/sources/Data/Database/DBAPI.uc @@ -128,9 +128,10 @@ public final function LocalDatabaseInstance NewLocal(BaseText databaseName) local Text rootRecordName; local LocalDatabase newConfig; local LocalDatabaseInstance newLocalDBInstance; + CreateLocalDBMapIfMissing(); - // No need to check `databaseName` for being valid, - // since `Load()` will just return `none` if it is not. + if (databaseName == none) return none; + if (!databaseName.IsValidName()) return none; newConfig = class'LocalDatabase'.static.Load(databaseName); if (newConfig == none) return none; if (newConfig.HasDefinedRoot()) return none;