File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
here-naksha-lib-model/src/commonMain/kotlin/naksha/model Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -839,18 +839,6 @@ class Naksha private constructor() {
839839 fun useStorage (config : NakshaStorage ): IStorage = _useStorage (config, null )
840840
841841 private fun _useStorage (config : NakshaStorage , forceCreateOrUpgrade : Boolean? ): IStorage {
842- val s = storagesByNumber[config.number]
843- val s2 = storagesById[config.id]
844- if (s != = s2) {
845- throw NakshaException (
846- ILLEGAL_ARGUMENT ,
847- " The storage-id (${config.id} ) and -number (${config.number} ) belong to different storages" )
848- }
849- if (s != null && s.config == config) {
850- // Only invoke initStorage, when we are forced to do it!
851- if (forceCreateOrUpgrade == true ) s.invokeInitStorage(config, create = true , upgrade = true )
852- return s
853- }
854842 lock.acquire().use {
855843 var storage = storagesByNumber[config.number]
856844 val storage2 = storagesById[config.id]
@@ -860,7 +848,10 @@ class Naksha private constructor() {
860848 " The storage-id (${config.id} ) and -number (${config.number} ) belong to different storages" )
861849 }
862850 if (storage != null ) {
863- if (storage.config == config) return storage
851+ if (storage.config == config) {
852+ if (forceCreateOrUpgrade == true ) storage.invokeInitStorage(config, create = true , upgrade = true )
853+ return storage
854+ }
864855 storage.invokeShutdownStorage(false )
865856 }
866857 val klass = Platform .klassForName<AbstractStorage <* >>(config.className)
You can’t perform that action at this time.
0 commit comments