Assign the config map when there is no default

This commit is contained in:
Robinson 2022-04-11 16:51:45 +02:00
parent bf5afb05bd
commit b8b43e5be1
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 8 additions and 3 deletions

View File

@ -96,13 +96,14 @@ open class Config<T: Any>(
}
}
if (localConfig == null) {
val generateLocalConfig = localConfig == null
if (generateLocalConfig) {
localConfig = createDefaultObject()
save()
configMap = createConfigMap(localConfig)
}
// now, we make a COPY of the original values from the file (so when saving, we know what the overloaded values are and not save them)
originalConfig = localConfig
originalConfig = localConfig!!
// create the map that knows what members have what values
originalConfigMap = createConfigMap(originalConfig)
@ -112,6 +113,10 @@ open class Config<T: Any>(
// create the map that knows what members have what values
configMap = createConfigMap(config)
if (generateLocalConfig) {
save()
}
return config
}