From 772e6659040fa076c30fc43df2141558e9c59834 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 19 May 2021 20:27:42 +0200 Subject: [PATCH] Use .apply on the Configuration.enabledFeatures mutable map --- .../fr/username404/snowygui/config/Configuration.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index 8a3f071..6247c51 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -70,9 +70,11 @@ object Configuration { writeConfig(it) } } - val enabledFeatures: MutableMap = if (obtained.hasPath("enabledFeatures")) { - obtained.extract("enabledFeatures") - } else mutableMapOf() + val enabledFeatures = mutableMapOf().apply { + if (obtained.hasPath("enabledFeatures")) { + putAll(obtained.extract("enabledFeatures")) + } + } val macros: MutableSet = run { if (!macroFile.exists()) macroFile.createNewFile() macroFile.readLines(Charset.forName("UTF-8")).map {